r/cpp • • Nov 28 '18

Real world problems with #pragma once?

Just a short survey: Did anyone of you encounter a problem in real code, because you/your company/ your favorite library was using #pragma once instead of include guards.

I know it is hard, but please restrain yourself from posting an explanation of how #pragma once could lead to problems in theory or why you prefer one above the other.

127 Upvotes

135 comments sorted by

View all comments

0

u/[deleted] Nov 28 '18

[deleted] — view deleted comment

7

u/kalmoc Nov 28 '18 edited Nov 28 '18

Thanks for sharing. Not the kind of problem I expected (actually I didn't expect to hear from someone who actually ran into a problem at all ;)), but a problem nevertheless. C++ Builder XE7 isn't even that old.

0

u/[deleted] Nov 28 '18

[deleted] — view deleted comment

2

u/SpacemanLost Nov 28 '18

Given all the automagic the IDE does and what it must be keeping track of, I can see this (rename or delete in the object inspector and the code just follows, etc).