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

2022-10-10 Thread Thiago Macieira
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

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

2022-10-10 Thread Paul Colby
Also worth considering https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-guards SF.8: > Note Some implementations offer vendor extensions like #pragma once > as alternative to include guards. It is not standard and it is not portable. > It injects the hosting machine’s filesystem

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

2022-10-10 Thread Henry Skoglund
On 2022-10-10 21:27, Thiago Macieira wrote: ... This situation is annoying either way. With include guards, you will get a working build, but you may spend some time trying to figure out why the changes you're making to the headers aren't taking effect. With the pragma, you get hard build errors

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

2022-10-10 Thread Scott Bloom
My two bits as a user of Qt. Please make sure any exposed headers use the old-school guards and NOT the #pragma once. I don’t care how the internal Qt headers work. However, Ive been burned too many times by the "known issues" of the #pragma once to want to use them. The problem isn’t if the

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

2022-10-10 Thread Thiago Macieira
On Monday, 10 October 2022 08:43:53 PDT Christian Kandeler via Development wrote: > On 10/10/22 17:13, Thiago Macieira wrote: > > The biggest problem we used to have was installing builds that had > > include > > paths pointing to both the source and installation directory. With > > preprocessor

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

2022-10-10 Thread Robert Griebl via Development
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

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

2022-10-10 Thread Christian Kandeler via Development
On 10/10/22 17:13, Thiago Macieira wrote: The biggest problem we used to have was installing builds that had include paths pointing to both the source and installation directory. With preprocessor guards, only one of the two would actually get included; with #pragma once, the files are actually

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

2022-10-10 Thread Thiago Macieira
On Monday, 10 October 2022 02:55:20 PDT Volker Hilsheimer via Development wrote: > Hi, > > > We are using `#pragma once` in a number of examples and tests in the Qt > source tree, but I don’t think we have officially endorsed it in favour of > explicit include guards. > #pragma once is

Re: [Development] Remaining tools in CMAKE_INSTALL_BINDIR

2022-10-10 Thread Ulf Hermann via Development
My question was for the developer's own plugins. Are these tools meant for the developer to test their QML importing their plugins? It might be surprising that it cannot find the plugins they've just installed to QML_PLUGIN_PATH, or worse, finds an older version of them. Indeed if you actually

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

2022-10-10 Thread EXT Mitch Curtis via Development
> -Original Message- > From: Development On Behalf Of > Volker Hilsheimer via Development > Sent: Monday, 10 October 2022 5:55 PM > To: development@qt-project.org > Subject: [Development] Using '#pragma once' instead of include guards? > > Hi, > > > We are using `#pragma once` in a

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

2022-10-10 Thread Hasselmann Mathias
I am surprised by the question: "It's non-standard and it's behavior is undefined" actually should be enough to avoid such feature. Actually if a reliable implementation of "#pragma once" would be possible, that feature would have been included in the C++ standard for a long time already,

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

2022-10-10 Thread Eike Ziller via Development
> On 10 Oct 2022, at 11:55, Volker Hilsheimer via Development > wrote: > > Hi, > > > We are using `#pragma once` in a number of examples and tests in the Qt > source tree, but I don’t think we have officially endorsed it in favour of > explicit include guards. > > #pragma once is

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

2022-10-10 Thread Volker Hilsheimer via Development
Hi, We are using `#pragma once` in a number of examples and tests in the Qt source tree, but I don’t think we have officially endorsed it in favour of explicit include guards. #pragma once is “non-standard but widely supported” [1], with some caveats, e.g. when there are multiple header