Order of evaluation in C++ function parameters

No, there’s no such guarantee. It’s unspecified according to the C++ standard. Bjarne Stroustrup also says it explicitly in “The C++ Programming Language” 3rd edition section 6.2.2, with some reasoning: Better code can be generated in the absence of restrictions on expression evaluation order Although technically this refers to an earlier part of the same … Read more

Does JSON syntax allow duplicate keys in an object?

The short answer: Yes but is not recommended. The long answer: It depends on what you call valid… [ECMA-404][1] “The JSON Data Interchange Syntax” doesn’t say anything about duplicated names (keys). However, [RFC 8259][2] “The JavaScript Object Notation (JSON) Data Interchange Format” says: The names within an object SHOULD be unique. In this context SHOULD … Read more

Why aren’t variable-length arrays part of the C++ standard?

[*] (Background: I have some experience implementing C and C++ compilers.) Variable-length arrays in C99 were basically a misstep. In order to support VLAs, C99 had to make the following concessions to common sense: sizeof x is no longer always a compile-time constant; the compiler must sometimes generate code to evaluate a sizeof-expression at runtime. … Read more

What are the rules about using an underscore in a C++ identifier?

The rules (which did not change in C++11): Reserved in any scope, including for use as implementation macros: identifiers beginning with an underscore followed immediately by an uppercase letter identifiers containing adjacent underscores (or “double underscore”) Reserved in the global namespace: identifiers beginning with an underscore Also, everything in the std namespace is reserved. (You … Read more