Hacker News new | ask | show | jobs
by mpyne 51 days ago
So use the C standard library instead of the C++ one. You still get RAII / constructors/destructors and runtime polymorphism, along with stronger compile-time type safety.

I frequently do that myself on simple C++ programs just for compile time reasons alone, where I'll use stdio.h instead of std::iostream or std::format.

1 comments

Designated initializers are gimped in C++;
C++ 20 added designated initializers, but the fields have to be specified in declaration order.
It partially added them. You can't use them out of order or skip members nor can you use the array initializers.