3 ms·
The common C/C++ subset is an outdated and non-standard C though. For instance standard-conforming C++ compilers cannot compile C99 code and onward, they're stu
by flohofwoe 6y ago
The common C/C++ subset is an outdated and non-standard C though. For instance standard-conforming C++ compilers cannot compile C99 code and onward, they're stuck at a non-standard C version that would roughly be C95, minus some things that are valid C but not valid C++.
- pjmlp 6y agoThey can compile more C11 code than C99, thanks to the stuff dropped in C11. They also support most of the C standard library additions. As of C++20, the biggest difference is that designated initializers must follow field declaration order, restrict and _Generic aren't supported, and the type safety semantics are stronger.
- flohofwoe 6y agoThere's also a handful of small differences like this, e.g. in C it's possible to construct a value and take the address for a pointer argument right in the function call: func(&(bla_t){ .x=1, .y=2 }); This is completely valid C, but invalid C++ (C++ has references as "workaround" for such adhoc-constructed parameters which shouldn't be passed by value).
- pjmlp 6y agoYes, that falls under my "type safety semantics are stronger" part of the comment.