[Development] Using '#pragma once' instead of include guards?

Robert Griebl robert.griebl at qt.io
Mon Oct 10 19:18:07 CEST 2022


On 10.10.2022 12:07, Eike Ziller via Development wrote:
>>  From what I see, it should in practice be ok to use. But perhaps I’m missing something. Does anything speak against using ‘#pragma once’ in new files?
> 
> Just for reference, we are using it without issues in Qt Creator since 2016.
> 
> (But of course our platform and compiler requirements are more restricted than for Qt.)

The same is true for the Pelagicore/Qt ApplicationManager: this project 
started in 2014 and only ever used "#pragma once" since, and we kept 
that even when it became an official Qt module.

No problems whatsoever, neither with qmake or cmake.

cu
Robert



More information about the Development mailing list