C++ Logo

std-proposals

Advanced search

Re: [std-proposals] #pragma once safer alternative

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 23 Mar 2025 00:30:11 -0700
On Saturday, 22 March 2025 23:34:03 Pacific Daylight Time Muhammad via Std-
Proposals wrote:
> this will not remove #pragma once or the inclusion guard technique as
> the first is a compiler-specific and the later is a valid preprocessor
> construct. I will just be an addition that tells the compiler to stop
> including that header file in any subsequent calls for it but in a
> unified manner.

Except it is not a unified manner. You did not address Jeremy's comment at all
when he said:

> The problem with pragma once is that every implementation has a *slightly*
> different way of determining file uniqueness (whether by file path, file
> contents, modification time, inode, etc). These each have their pros and
> cons but the implementation divergence is where the portability problems
> originate. [...]
> But, inevitably, this would require some
> implementations to change their behavior slightly.

If you're not proposing any change in behaviour, just a different spelling, why
do we need to change anything?
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-03-23 07:30:16