C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Charles R Hogg <charles.r.hogg_at_[hidden]>
Date: Wed, 25 Sep 2024 09:52:49 -0400
Randomly generated include guard names might sound appealing at first, but
it seems to me they're vulnerable to being thoughtlessly copy-pasted to a
new file. Real users often do this when spinning up a new file.
File-based include guard names can have this same problem, of course, but
at least in that case we can define linter rules for our project and catch
this.

On Wed, Sep 25, 2024 at 4:02 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:

> Thiago wrote:
> >
> > Any modification of existing practice is also a no-go. That's also why
> #once
> > (instead of #pragma once) has not gained traction.
> >
> > If you have to create an identifier, you may as well use include guards,
> which
> > do require such an identifier.
>
>
> So it looks like in future I might just do:
>
> #ifndef INCLUSION_GUARD_464684684979817943466986579767572
> #define INCLUSION_GUARD_464684684979817943466986579767572
> . . .
> #endif // INCLUSION_GUARD
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-09-25 13:53:02