4 ms·
Headers and C style macros are probably the most unfortunate aspects of C (and by extension, C++). So many hacks in compilers to try to work around this. A sh
by Scubabear68 3y ago
Headers and C style macros are probably the most unfortunate aspects of C (and by extension, C++).
So many hacks in compilers to try to work around this. A shame there is no language level fix for this nonsense.
Really wish there could be a C++—- that would improve on C in areas like this, and avoid all the incredible nonsense of C++. And no, not Rust or Go.
- pphysch 3y agoHeaders (in new code) will hopefully become optional due to modules. That would be such a big boost to the language. C Macros are pretty much considered code smell in C++, right?
- zyedidia 3y agoI think Hare (https://harelang.org/ https://harelang.org/) might fit the bill: it retains the minimalism and simplicity of C, but fixes issues like this (and others). Unfortunately I don't think it's ready for real use yet, but I am keeping an eye on it.
- pxeger1 3y agoHave you tried Zig? I think it fits those criteria, and is known for its good build system, although AIUI it is quite a large language compared to C
- flohofwoe 3y ago> Headers and C style macros are probably the most unfortunate aspects of C (and by extension, C++). Headers only became a massive problem in C++ because of templates and the unfortunate introduction of the inline keyword (which then unfortunately also slipped into C99, truly the biggest blunder of the C committee next to VLAs). Typical C headers (including the C stdlib headers) are at most a few hundred lines of function prototypes and struct declarations. Typical C++ headers on the other hand (include the C++ stdlib headers) contain a mix of declarations and implementation code in template and inline functions and will pull in tens of thousands of lines of code into each compilation unit. This is also the reason why typical C projects compile orders of magnitude faster than typical C++ projects with a comparable line count and number of source files.