Comment by bogwog
4 days ago
I don't understand what you're saying here. #pragma once does the job that include guards used to do, but with less work, and in a less error prone way. How is it broken, and how is the size of a project relevant?
4 days ago
I don't understand what you're saying here. #pragma once does the job that include guards used to do, but with less work, and in a less error prone way. How is it broken, and how is the size of a project relevant?
> I don't understand what you're saying here. #pragma once does the job that include guards used to do, (...)
They don't. They are not C++ and at most they are compiler-specific.
It's fine if you opt to not write C++ and instead target specific compilers instead. Just don't pretend it's not frowned upon or kosher.
TIL about the existence of a passionate #pragma once hating subculture.
Since you seem to be more knowledgeble about this, I'm curious to know which C++ compilers lack support? I know that at least the 3 big ones do (GCC, Clang, and MSVC) and they have for a very long time.
it's absolutely not frowned upon in 2025. All the compilers that matter (GCC, Clang and MSVC) support and have supported them for two decades. Major projects use #pragma once internally - I see files using it in Qt, LLVM, etc.