Re:Confession Of A C/C++ Programmer (2017)
by flohofwoe on Tuesday January 26, 2021 @04:30AM
(#25913960)
There'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).
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.