pragma once

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

pragma once

Paul Ramsey
As I fart around w/ header guards every time I add a new header/class, I wonder if changing over to #pragma once would be OK with one and all? GCC has had it 3.4, and clang has always had it, so…?

P.
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: pragma once

Greg Troxel-2
Paul Ramsey <[hidden email]> writes:

> As I fart around w/ header guards every time I add a new header/class,
> I wonder if changing over to #pragma once would be OK with one and
> all? GCC has had it 3.4, and clang has always had it, so…?

Is that covered by any standards?

(Presumably there is some other compiler people use on windows, too.)
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: pragma once

Paul Ramsey
"non standard but widely supported" 


Includes MSVC! :)

P

On Wed, Dec 19, 2018 at 7:01 AM Greg Troxel <[hidden email]> wrote:
Paul Ramsey <[hidden email]> writes:

> As I fart around w/ header guards every time I add a new header/class,
> I wonder if changing over to #pragma once would be OK with one and
> all? GCC has had it 3.4, and clang has always had it, so…?

Is that covered by any standards?

(Presumably there is some other compiler people use on windows, too.)

_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: pragma once

Mika Heiskanen
In reply to this post by Greg Troxel-2

From: geos-devel <[hidden email]> on behalf of Greg Troxel <[hidden email]>

> Paul Ramsey <[hidden email]> writes:
>
> > As I fart around w/ header guards every time I add a new header/class,
> > I wonder if changing over to #pragma once would be OK with one and
> > all? GCC has had it 3.4, and clang has always had it, so…?
>
> Is that covered by any standards?
>
> (Presumably there is some other compiler people use on windows, too.)

No, it is not part of any standard. Compiler support is quite extensive though,
see for example https://en.wikipedia.org/wiki/Pragma_once

Mika Heiskanen

_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: pragma once

Greg Troxel-2
In reply to this post by Paul Ramsey
Paul Ramsey <[hidden email]> writes:

> "non standard but widely supported"
>
> https://en.wikipedia.org/wiki/Pragma_once
>
> Includes MSVC! :)

As much as I hate to depart from standards, that does look near
universal.
_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel
Reply | Threaded
Open this post in threaded view
|

Re: pragma once

Howard Butler-3

On 12/19/18 11:26 AM, Greg Troxel wrote:
> Paul Ramsey <[hidden email]> writes:
>
>> "non standard but widely supported"
>>
>> https://en.wikipedia.org/wiki/Pragma_once
>>
>> Includes MSVC! :)
> As much as I hate to depart from standards, that does look near
> universal.


Go for #pragma once. We haven't regretted it in PDAL for the nearly
eight years we've existed. It cleans up tons of #ifdef churn and culls a
set of difficult-to-debug situations (same ifdef being used from
copypasta code). 


You have probably clipped off every compiler that doesn't support
#pragma once with the C++11 requirement anyway...


Howard



_______________________________________________
geos-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geos-devel

signature.asc (540 bytes) Download Attachment