r/C_Programming • u/Yuki_pop • 27d ago
Could someone explain the practical differences between #pragma once and traditional include guards (#ifndef, #define, and #endif)?
84
Upvotes
r/C_Programming • u/Yuki_pop • 27d ago
View all comments
Show parent comment
-4
u/Huuf 26d ago
I don't fully agree with the including the same header twice is bad part, for example, a string library, if you can only use a string library handling in one spot, you won't get very far. Or an animal header, where the dog.c and cat.c both include it. Also, by definition, one header will always be included twice, since the implementation includes it, and the caller needs to include it.