Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor argument evaluation IMHO not necessarily left to right #1

Open
PeterSommerlad opened this issue Apr 13, 2021 · 1 comment

Comments

@PeterSommerlad
Copy link

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

return ReturnCode{open(fileName), errno};

@PeterSommerlad
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant