C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Gašper Ažman <gasper.azman_at_[hidden]>
Date: Mon, 2 Sep 2024 11:40:26 +0100
The problem is that the search path is not the same for every #include you
encounter - in fact, it's different for every include in a different file,
and you can also have include aliases and include_next and literal virtual
filesystem include maps for parts of your includes.

So, no, you won't get to the same file in the same way every time
(incidentally I know this happens all the time because it breaks bazel
sandboxing sometimes).

On Mon, Sep 2, 2024, 11:34 Tiago Freire via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> > An #include has no need to tell two files apart. Could you please
> explain what you're talking about here?
>
> It needs to find a file, not just any file, it needs to find a specific
> file. Which has an identity, it doesn't go about looking at inodes to
> figure if the file I specified is the one I actually intended.
> You don't go about "hey what happens if network files recycle inodes,
> include doesn't work".
> That include files work based of file paths alone is not a cause for
> confusion, and so shouldn't pragma once.
>
>
> ------------------------------
> *From:* Ville Voutilainen <ville.voutilainen_at_[hidden]>
> *Sent:* Monday, September 2, 2024 12:06:28 PM
> *To:* std-proposals_at_[hidden] <std-proposals_at_[hidden]>
> *Cc:* Tiago Freire <tmiguelf_at_[hidden]>; Tom Honermann <
> tom_at_[hidden]>
> *Subject:* Re: [std-proposals] Revising #pragma once
>
> On Mon, 2 Sept 2024 at 06:24, Tiago Freire via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > Don't define what system calls are needed in the standard.
> > This was always going to be platform dependent.
> >
> > We know for sure that comparing file paths alone would do the trick.
> Which doesn't even require opening files, the only thing it requires is to
> exist to register a hit for your #include directive.
> > If you need more than that to tell 2 files apart then you can't even
> guarantee what the "#include" directive is doing.
> >
> > Is anyone going to argue that "#include" directives are unimplementable?
>
> I continue to fail to understand these arguments along the lines of
> "then #include doesn't work either". An #include
> has no need to tell two files apart. Could you please explain what
> you're talking about here?
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-09-02 10:40:40