Hacker News new | past | comments | ask | show | jobs | submit login

I've come to despise how tightly integrated the C++ standard library is now with the c++ language itself, it is clearly evolving in a direction to make the two inseparable, but it is also making it less desireable. One cannot even compile a c++ executable with the /NODEFAULTLIB flag and not break core language features, e.g. static global object construction, dynamic_cast, ... For the purists that would like to separate the standard library from the language, and make tiny executables not depending on the runtime library, C is the only choice now it seems.



This is what “freestanding” is for, FWIW. There are a variety of papers and implementations around this goal, which is generally to have a set of features of c++ the language and the standard library that can work entirely unhosted.

I realize people think of this as a difference between c and c++, but if you go to compile C code with a thread_local variable and throw -nostdlib you’re going to have a bad day. Same for atomics, sometimes complex numbers, floating point exceptions, even receiving arguments and other core language features require some crt code. Removing the runtime library guts the implementation regardless of your language. The question is, does your language provide ways to deal with this? Rust has core, c has alternate ad-hoc embedded libc implementations and a history of bootstrapping implementations long enough to have them be well understood, c++ has/will have free-standing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: