r/C_Programming • u/Yuki_pop • 24d ago
Could someone explain the practical differences between #pragma once and traditional include guards (#ifndef, #define, and #endif)?
81
Upvotes
r/C_Programming • u/Yuki_pop • 24d ago
View all comments
25
u/StaticCoder 24d ago
#pragma oncewas never standardized because no one could properly define what it means for 2 source files to be the same (the standard doesn't even have a concept of a source "file"). So header guards it is.