News for hackers. Stuff that matters.
Re:Unity builds lurked into the Firefox Build System by Scubabear68 on Saturday May 06, 2023 @03:24PM (#35844554)
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.

Re:Unity builds lurked into the Firefox Build System by pphysch on Saturday May 06, 2023 @03:32PM (#35844647)
Headers (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?

Re:Unity builds lurked into the Firefox Build System by zyedidia on Saturday May 06, 2023 @04:04PM (#35844911)
I think Hare (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.
Re:Unity builds lurked into the Firefox Build System by pxeger1 on Saturday May 06, 2023 @05:47PM (#35845620)
Have 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
Re:Unity builds lurked into the Firefox Build System by flohofwoe on Sunday May 07, 2023 @04:29AM (#35849181)
> 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.

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.