3 ms·
> We try to mitigate it with #ifdef guards, #pragma once etc. but in my experience those band-aids don’t solve the problem. Huh, I wonder why he thinks so? "#p
by theamk 3y ago
> We try to mitigate it with #ifdef guards, #pragma once etc. but in my experience those band-aids don’t solve the problem.
Huh, I wonder why he thinks so? "#pragma once" works pretty well and completely eliminates "double-parsing includes" problem within single file.
(And if you want to eliminate multiple parsing of includes _across_ the files, you need something like modules, no amount if include discipline will help)
Pretty sure that whatever beneficial effect author gets (if any), it's not from double include elimination. A much more likely explanation is that by making includes painful, author self-encourages to include less stuff and to keep simpler hierarchy.