Closed fedztech closed 4 years ago
Hi @fedztech
Thanks for raising this interesting question. We are aware that "#pragma once" is not ISO C++. We had the impression that all relevant compilers support it and thought it is less error-prone than the old include guards. Somehow "#pragma once" is a de-facto standard. If a compiler vendor provides a certified compiler and this includes also the "#pragma once" functionality, we feel that it should be OK. Or what do you think?
But your issue definitely made the discussion come up again :-) . There are also reasons to switch back to good old include guards. Changing it is not a big deal, just a day of less fun. We keep you in the loop.
We'll extend the documentation in the next few weeks to cover this topic. And also will update this issue then.
Reopening, as we decided to switch from pragma once to include guards.
@marthtz FYI
pragma once is indeed a nice feature, yet not part of the standard and shall not be used (for portability issues for example). Not to mention that standards like Autosar Guidelines for C++ 14 and Misra c++ 08 do not allow it.
Modules in C++ 20 will surely be nice, but it's adoption will take some time in the industry. Having pragma once here will definitely slow down the adoption of iceoryx.