andreasfertig / programming-with-cpp20

Companion source code for "Programming with C++20 - Concepts, Coroutines, Ranges, and more"
MIT License
217 stars 63 forks source link

constructor argument evaluation IMHO not necessarily left to right #1

Open PeterSommerlad opened 3 years ago

PeterSommerlad commented 3 years ago

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

https://github.com/andreasfertig/programming-with-cpp20/blob/491c83d0991ba70b3b0b42f671ba92654e897a37/08.30-structuredBindingsPOSIXError4/main.cpp#L23

PeterSommerlad commented 3 years ago

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