Skip to content

constructor argument evaluation IMHO not necessarily left to right #1

Open
@PeterSommerlad

Description

@PeterSommerlad

The following code might read errno before calling open... I am happy to be convinced otherwise.

return ReturnCode{open(fileName), errno};

Activity

PeterSommerlad

PeterSommerlad commented on Apr 13, 2021

@PeterSommerlad
Author

see

"21) Every expression in a comma-separated list of expressions in a parenthesized initializer is evaluated as if for a function call (indeterminately-sequenced) "

on https://en.cppreference.com/w/cpp/language/eval_order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      constructor argument evaluation IMHO not necessarily left to right · Issue #1 · andreasfertig/programming-with-cpp20