> On 25. Jan 2018, at 11:53, Mitch Curtis <[email protected]> wrote: > >> -----Original Message----- >> From: Development [mailto:development-bounces+mitch.curtis=qt.io@qt- >> project.org] On Behalf Of Mathias Hasselmann >> Sent: Thursday, 25 January 2018 11:27 AM >> To: [email protected] >> Subject: Re: [Development] #pragma once >> >> Let's see what people who know much more about compiler features than >> any of us think about "#pragma once". Let's check what GCC and Clang do for >> their C++ library headers: >> >> $ grep -r pragma.*once /usr/include/clang/5.0.0/include >> /usr/include/c++/7.2.0/ >> $ >> >> ...and this is about headers that target exactly one compiler and are known >> to be locally installed. >> >> Hope this helps, >> Mathias > > It kinda helps, although it doesn't say why they chose that. I'm here to > learn why we're not using it, not to try to convince everyone that we should > be using it. The reasons I've seen so far (build system stuff, etc.) are > outside my experience, so I guess I'm just gonna have to be content with > "just don't do it". :)
Both have their own sets of inadequacies it seems, so switching from one to the other mostly changes these sets, but users of Qt are at least used to the current set. In Qt Creator we control most users of the API, the set of used compilers is smaller, and in general the scope, so switching there was not much of a risk. The benefit in Qt Creator is also greater, because it makes refactoring easier, and that is something that we do a lot in Qt Creator code. > Am 24.01.2018 um 13:19 schrieb Mitch Curtis: >>> >>> >>>> -----Original Message----- >>>> From: Ville Voutilainen [mailto:[email protected]] >>>> Sent: Wednesday, 24 January 2018 1:11 PM >>>> To: Mitch Curtis <[email protected]> >>>> Cc: Alexander Nassian <[email protected]>; >>>> development@qt- project.org >>>> Subject: Re: [Development] #pragma once >>>> >>>> On 24 January 2018 at 12:34, Mitch Curtis <[email protected]> wrote: >>>>> >>>>> >>>>>> -----Original Message----- >>>>>> From: Ville Voutilainen [mailto:[email protected]] >>>>>> Sent: Wednesday, 24 January 2018 11:25 AM >>>>>> To: Alexander Nassian <[email protected]> >>>>>> Cc: Mitch Curtis <[email protected]>; [email protected] >>>>>> Subject: Re: [Development] #pragma once >>>>>> >>>>>> On 24 January 2018 at 12:22, Alexander Nassian <nassian@bitshift- >>>>>> dynamics.com> wrote: >>>>>>> Maybe because it’s not part of the C++ standard? >>>>>> >>>>>> #pragma once is not a replacement for include guards. >>>>> >>>>> Why not? >>>>> >>>>>> It's not part of the C++ standard because it doesn't always work >>>>> >>>>> In which ways? My quick search gave me these: >>>>> >>>>> https://stackoverflow.com/a/1946730/904422 >>>>> https://en.wikipedia.org/wiki/Pragma_once#Caveats >>>> >>>> That wikipedia link seems to describe the problems fairly accurately. >>> >>> Do we have that issue in Qt? >>> >>>>>> and modules are a superior solution anyway. >>>>> How so? >>>> >>>> Because you can import the same module multiple times without >>>> concerns about re-definitions, and that import is much faster than >>>> parsing a header file. >>> _______________________________________________ >>> Development mailing list >>> [email protected] >>> http://lists.qt-project.org/mailman/listinfo/development >>> >> _______________________________________________ >> Development mailing list >> [email protected] >> http://lists.qt-project.org/mailman/listinfo/development > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development -- Eike Ziller Principal Software Engineer The Qt Company GmbH Rudower Chaussee 13 D-12489 Berlin [email protected] http://qt.io Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
