[Development] Using '#pragma once' instead of include guards?
Thiago Macieira
thiago.macieira at intel.com
Mon Oct 10 23:00:58 CEST 2022
On Monday, 10 October 2022 13:20:56 PDT Henry Skoglund wrote:
> But perhaps there could be use of #pragma once anyway, as a way to
> detect those duplicate files? Say something like this at the top of an
> .h file:
>
> #pragma once
> #if defined QGLOBAL_H
> #error "Multiple instances of qglobal.h detected"
> #endif
> #define QGLOBAL_H
> ...
I thought of that but didn't write in my reply because, though it helps
identify the problem, it doesn't help the poor non-developer who ran into the
problem. They'll still get hard errors either way, probably several screenfuls
of them.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Cloud Software Architect - Intel DCAI Cloud Engineering
More information about the Development
mailing list