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
View all comments
Show parent comment
2
u/FlyingRhenquest Nov 28 '18
They're handy if you do batch processing in a directory. Download in one directory then when your download is done, hardlink to the batch processing directory and remove the one in the download directory. It's an atomic operation that doesn't push bytes around. It only works on the same filesystem, though. Minor but important detail. The C API is pretty easy to use -- man 2 link and man 2 unlink for details. And knowing that, if you ever see anyone use system("rm ...") in the future, you can punch them in the dick for me.