|
Boost : |
Subject: Re: [boost] Guidence on #pragma once
From: charleyb123 (charleyb123_at_[hidden])
Date: 2018-11-25 13:20:48
On Sun, Nov 25, 2018 at 6:17 AM James E. King III via Boost <
boost_at_[hidden]> wrote:
> On Sun, Nov 25, 2018 at 8:02 AM charleyb123 via Boost
> <boost_at_[hidden]> wrote:
> >
> > On Sun, Nov 25, 2018 at 5:46 AM Olaf van der Spek via Boost <
> > boost_at_[hidden]> wrote:
> >
> > > On Sat, Nov 24, 2018 at 2:01 AM Andrey Semashev via Boost
> > > <boost_at_[hidden]> wrote:
> > > > since `#pragma once` is non-standard and not reliable, there's little
> > >
> > > Who has a sane reproducible test case showing the claimed
> unreliability?
> > >
> >
> > The '#pragma once' discussion occasionally comes up in the Qt community,
> > and they repeatedly decide to not use it.
> >
> > It came up again last month, and here is a use case of claimed
> > unreliability (from Thiago):
> >
> > > For example, I have ~/src as a bind-mount to ~/dev/src. That means
> > > ~/src/qt/qt5/qtbase/src/corelib/global/qglobal.h
> > > ~/dev/src/qt/qt5/qtbase/src/corelib/global/qglobal.h
> > > are actually the same file, but they aren't for the effects of #pragma
> once
> > > because the paths differ.
> > >
> > > Another problem is qcompilerdetection.h, qprocessordetection.h,
> > > qsystemdetection.h, qtypeinfo.h, etc. which depend on the header
> guards to
> > > break the include cycle. Ditto for qlist.h + qstringlist.h and
> > > qbytearraylist.h
> >
> > Excerpt from:
> > *-
> >
> https://lists.qt-project.org/pipermail/development/2018-October/033733.html
> >
> > --charley
> >
>
> The include search path ordering for the compilation unit does not change
> during compilation. Either ~/src or ~/dev/src will be first in the
> search path,
> therefore #pragma once would work properly for that case.
>
> - Jim
>
Agree, except "current-dir" will be searched first for all `#include ""`,
which would override the include search path order.
--charley
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk