RE: #pragma once (was Re: incoming)

From: David Laight
Date: Mon Mar 01 2021 - 14:36:20 EST


From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Sent: 26 February 2021 23:02
>
> On Fri, Feb 26, 2021 at 01:53:48PM -0800, Linus Torvalds wrote:
> > On Fri, Feb 26, 2021 at 12:17 PM Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
> > >
> > > I want to sent treewide "#pragma once" conversion:
> >
> > Are there *any* advantages to it?
> >
> > It's non-standard,
>
> It is effectively standard:
> https://en.wikipedia.org/wiki/Pragma_once#Portability

At the top of the page....

In the C and C++ programming languages, pragma once is a non-standard but widely supported

So non-standard :-)

And #pragma is ugly...

There are also times when an include guard has to be set in order to stop
a problematic inner file being included.
Perhaps only during hacking, but it is useful.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)