r/C_Programming • • 28d ago

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

81 Upvotes

58 comments sorted by

View all comments

Show parent comment

3

u/Emotional-Audience85 28d ago

I interpreted it has having the file included through different physical paths (e.g. one is a symlink to the same file).

I've never encountered this but I believe it may be an issue for #pragma, as the same file may be treated as 2 different files and the content be pasted twice, leading to compilation errors

1

u/Huuf 28d ago

If that is meant, I totally agree,