C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] #once proposal

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Thu, 3 Feb 2022 22:15:12 +0100
On 03/02/2022 21.08, Christof Meerwald via Liaison wrote:
> On Thu, Feb 03, 2022 at 08:50:30PM +0100, Miguel Ojeda via Liaison wrote:
>> On Thu, Feb 3, 2022 at 8:29 PM Steve Downey via Liaison
>> <liaison_at_[hidden]> wrote:
>>> Is there any chance that this gets adopted? Because at scale it doesn't work, and causes both structural and transient problems, and it will be even harder to get people not to use it if it's in the standard.
>>
>> Of course there is a chance -- as with any other proposal. The
>> no-identifier form does have pitfalls depending on how a compiler
>> defines it, but it is widely used everywhere. The paper is
>> standardizing existing practice (and, by doing that, asking compilers
>> to document it).
>
> Existing practice is to use "#pragma once" which already has
> implementation defined behavior - the paper proposes to change
> "#pragma once" to "#once" with implementation defined behavior.
> Doesn't really look like much of an improvement to me.

Agreed. Those that want to use it, can (and probably do) already
use #pragma once with exactly the non-portable implementation-defined
semantics they apparently want. There's no need to add another
syntactic form of non-portable implementation-defined semantics here.

I can see a (weak) case for "#once identifier", which at least
has a proper definition in the framework of the C preprocessor.

Jens

Received on 2022-02-03 21:15:26