programming-with-cpp20 icon indicating copy to clipboard operation
programming-with-cpp20 copied to clipboard

constructor argument evaluation IMHO not necessarily left to right

Open PeterSommerlad opened this issue 3 years ago • 1 comments

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 avatar Apr 13 '21 12:04 PeterSommerlad

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

PeterSommerlad avatar Apr 13 '21 13:04 PeterSommerlad