3 ms·
No C++ does not specify evaluation order in this case. Remember "<<" is just that, an operator. Only && and || have a mandated evaluation order.
by knz42 12y ago
No C++ does not specify evaluation order in this case.
Remember "<<" is just that, an operator.
Only && and || have a mandated evaluation order.
- nitrogen 12y agoIn that case, is a compiler allowed to instantiate both ThrowOnError objects before calling either of the C functions?
- huhtenberg 12y agoNo. Overloaded operators act like functions and functions are sequence points.
- MaulingMonkey 12y agoFunctions have a sequence point that insists their arguments are evaluated before the function is called, but having both ThrowOnError objects constructed before calling any of the other functions would still satisfy that constraint.
- deleted 12y ago[deleted]
- apaprocki 12y agoKind of OT, but since we're talking language interop, Fortran has neither eager nor short-circuit and/or and it is completely up to the compiler what optimizations it makes. Since Fortran ABI works directly with C (and by extension C++) natively, I've seen a whole class of bugs opened up by C/C++ devs either reading or writing Fortran not aware that this could happen. Try removing that from your mental model of how boolean logic works!