Skip to content

Use of std::flush in std::cerr #935

@zixin96

Description

@zixin96

The book: Ray Tracing in One Weekend
Specific location: 2.3. Adding a Progress Indicator, Listing 3

Hello everyone! I recently started to learn about the usage of std::flush and found that our code used
std::cerr << "\rScanlines remaining: " << j << ' ' << std::flush;.

However, since std::cerr is not buffered like std::cout, wouldn't this make our std::flush redundant? If not, what is the purpose of std::flush here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions