[Development] Using #pragma once

André Pönitz apoenitz at t-online.de
Sun Oct 7 11:06:05 CEST 2018


On Sun, Oct 07, 2018 at 08:56:47AM +0000, Lars Knoll wrote:
> Hi,
> 
> Just a quick question: Does anybody have any good arguments against us
> starting to use #pragma once instead of header guards throughout our
> code base?

Not me.
 
> I’ve started using it implicitly when updating 3rd party code (the
> macro assembler) in qtdeclarative without any problems (so I’d
> supported by all our compilers). IMO #pragma once is both safer and
> nicer to use than classic header guards.

Qt Creator uses it since more than two years without problems.

For a potential conversion https://github.com/cgmb/guardonce
may help.

Andre'



More information about the Development mailing list