Hacker News new | ask | show | jobs
by midnightclubbed 2383 days ago
Agree, CODEORG-3 adds a bunch of pain. There's a reason other languages don't have headers but since C programmers have to live with them can't I just include the single relevant header and move on with writing my code. Yes there is a shared cost to that (compile time) but '#pragma once' is well supported and futzing with header order is a non trivial time-sink too.

On the same lines the template 'cute tricks' are where you get your performance, stability and readability from C++. I definitely agree that you should drop into assembly to see what the compiler is doing with your code but that can and should apply to heavily templated code too.

1 comments

Pragma once only prevents double inclusion within the translation unit.

On large projects bad header hygiene can cause significant compilation overhead.