4 ms·
I agree, e.g. they recommend not using `#pragma once` because: > It injects the hosting machine's filesystem semantics into your program, in addition to lockin
by IshKebab 9y ago
I agree, e.g. they recommend not using `#pragma once` because:
> It injects the hosting machine's filesystem semantics into your program, in addition to locking you down to a vendor. Our recommendation is to write in ISO C++
Erm. What. Compiling anything other than a one-file program "injects the filesystem semantics into your program". I mean... your program is stored in a filesystem. #include uses a filesystem. What utter tosh.
And as for locking you down to a vendor, even niche compilers that you've probably never heard of support it.
https://en.wikipedia.org/wiki/Pragma_once#Portability https://en.wikipedia.org/wiki/Pragma_once#Portability
I'd take anything from there with a boulder of salt.
- izacus 9y agoHrmf, what I think they tried to say is that #pragma once causes your code to compile differently depending on which file it's stored inside. This can cause problem with some tooling (e.g. precompiled header generators, some distributed compiler tools, etc.) which concatenate header and source files to generate an amalgam. So it's not "tosh", it probably just doesn't correspond to your way of writing C++ code.