r/C_Programming • • 27d ago

Could someone explain the practical differences between #pragma once and traditional include guards (#ifndef, #define, and #endif)?

82 Upvotes

58 comments sorted by

View all comments

4

u/TheLimeyCanuck 27d ago

It's just syntactical sugar. They do the same thing but the #ifndef method always works whereas #pragmas are not always supported.