C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Mon, 23 Sep 2024 12:59:18 +0000
Until someone doesn't put a copyright on their files, and thus sending you back to the standards proposal.
The solution should make sense absent a copyright, unless you want to enforce unique copyright statements in the standard as well.

As stated, going beyond the absolute simplest and obvious solution, as well intended as it may be, it does more harm than good.


-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_[hidden]pp.org> On Behalf Of Henry Miller via Std-Proposals
Sent: Monday, September 23, 2024 2:51 PM
To: Henry Miller via Std-Proposals <std-proposals_at_lists.isocpp.org>
Cc: Henry Miller <hank_at_millerfarm.com>
Subject: Re: [std-proposals] Revising #pragma once


On Mon, Sep 23, 2024, at 05:55, Gašper Ažman via Std-Proposals wrote:
> HASH DOES NOT WORK. There are reasons for this in this thread, but
> they boil down to this: you'd need to hash the entire reachable
> filesystem because #include's don't resolve the same way depending on
> where the file is accessed from on the filesystem.
>
> #pragma once
> #include "utils.h"
>
> You'll see that header verbatim several times for different libraries
> in a translation unit and you'll miscompile. HASH DOES NOT WORK.
>

I do not believe you are correct there. While you will see the functional parts of the above verbatim, in the real world every header I've seen as a copyright comment and those are typically different. Also different projects have different coding standards for blank lines between said copyright, the #pragma, and the #include. If you account for those in the hash odds are high the files won't match.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]pp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-09-23 12:59:24