C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Tom Honermann <tom_at_[hidden]>
Date: Tue, 27 Aug 2024 16:39:28 -0400
On 8/27/24 4:10 PM, Thiago Macieira via Std-Proposals wrote:
> On Tuesday 27 August 2024 12:35:17 GMT-7 Andrey Semashev via Std-Proposals
> wrote:
>> The fact that gcc took the approach to compare file contents I consider
>> a poor choice, and not an argument to standardize this implementation.
> Another question is whether a byte comparison of two files of the same size is
> expensive for compilers.
>
> #once ID doesn't need to compare the entire file.

Another question is whether the comparison should be post translation
phase 1. In other words, whether differently encoded source files that
decode to the same sequence of code points are considered the same file
(e.g., a Windows-1252 version and a UTF-8 version). Standard C++ does
not currently allow source file encoding to be observable but a #pragma
once implementation that only compares bytes would make such differences
observable.

Tom.

Received on 2024-08-27 20:39:33