r/C_Programming • u/Yuki_pop • 22d 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 • 22d ago
View all comments
19
u/Alex_1503 22d ago
Pragma once is not (or was not) supported on all compilers, ifndev is more traditional, if I understand correctly. Nowadays idk if it matters, but the approaches are kind of identical if supported. Probably ifndef is more portable if that is a concern