El 19 de febrero de 2024 11:13:34 UTC, "Enrico Weigelt, metux IT consult" <i...@metux.net> escribió: >Hello folks, > >we've got a lot of include files, therefore lots of guards. > >Modern C compilers should understand #pragma once, but this isn't >without problems (possibly problematic with symlinks ?), and I have >to admit I don't how well is it supported outside of GNU land. > >Can we rely on it ? >
You can expect compilers to optimise for #ifdef guards exactly in the same way, so no gain. At least GCC and Clang do, see: * <https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html> * <https://clang.llvm.org/docs/InternalsManual.html#the-multipleincludeopt-class>