r/C_Programming • • 28d ago

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

83 Upvotes

58 comments sorted by

View all comments

Show parent comment

2

u/WittyStick 28d ago

I've not tried, but you can use _Pragma in a macro. Maybe

#define once _Pragma("once")

1

u/actguru 28d ago

Worked for me. But I like ' $once '.