C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sun, 1 Sep 2024 23:08:51 +0300
On 9/1/24 19:44, Thiago Macieira via Std-Proposals wrote:
> On Sunday 1 September 2024 09:17:05 GMT-7 Jeremy Rifkin wrote:
>> I agree. Much of the point of standardizing would be providing
>> guarantees about what "same file" means.
>>
>> For wording, one option is to borrow some wording from
>> std::filesystem::equivalent
>
> And again, as Tom's report showed but he didn't highlight,
> std::filesystem::equivalent will come to different conclusions too.
>
> The MS STL implementation uses GetFileInformationByHandleEx(), so it can
> compare the 128-bit unique identifier. The libstdc++v3 and libcxx
> implementations use GetFileInformationByHandle(), so they suffer from the same
> problem as Coverity did.

They don't, as long as they keep both files open while obtaining and
comparing file ids. Which std::filesystem::equivalent is able to do,
unlike Coverity or a C++ compiler, as that would substantially increase
system resource consumption during compilation.

> And then you have Cygwin, whose source of stat() I
> can't find, but is used to supply the builds of GCC, so GCC's fs::equivalent
> will be the Unix implementation through Cygwin, not the native Windows build.

Given that the underlying system is still Windows, I wouldn't expect
miracles.

Received on 2024-09-01 20:08:56