Hacker News new | ask | show | jobs
by quickben 3446 days ago
"The C compilation model of separate header files is not a good design"

This is probably just your lack of experience not having worked on 50+ million LOC compiling for 12 hours and not having anything else as a better option. There is a reason these things exist.

6 comments

I've worked on a project that combined C++ and C# in approximately equal amounts (say 2MLOC each). The C++ project compiled and linked for 20 minutes , C# compiled and linked in under 2 minutes. Go figure.

I agree: C and C++ compilation model is not a good design. It's a patch for not having a decent module system. Heck, even Borland Pascal compiled faster in 90-ies than C++ does now on an orders of magnitude faster machine.

For as long as C has existed, other languages have provided alternatives where symbol information is extracted from the main source files automatically by the compiler and optionally cached for next time, or if you don't want to ship users of a library source, for example. In other words: This has been solved in a better way since the 70's.
> There is a reason these things exist.

Enlighten me. And while you're at it, explain why this is better than, say, Rust's module system, where we don't need separate header files.

Isn't the limitations of the header file system the reason why the C++ module system is being developed?

Why wouldn't something like the C++ module system be of benefit in C also?

One of the reasons it seems.

It would, but by the look of it, C++ evolves faster these days.

??? Header files is the problem, not the solution.
Do you want to clarify that, because I think you may have missed a "not" in there.