C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Mon, 23 Sep 2024 12:22:18 +0000
You can include the same file twice.... that's the problem.

-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Jiri Bobek via Std-Proposals
Sent: Monday, September 23, 2024 2:02 PM
To: Ville Voutilainen <ville.voutilainen_at_[hidden]om>
Cc: Jiri Bobek <jiri.bobek_at_[hidden]>; std-proposals_at_lists.isocpp.org
Subject: Re: [std-proposals] Revising #pragma once

One has to wonder how C++ survived 40 years given that:
- you cannot include the same file twice
- deciding if it's the same file is impossible


On Mon, Sep 23, 2024 at 1:24 PM Ville Voutilainen <ville.voutilainen_at_gmail.com> wrote:
>
> On Mon, 23 Sept 2024 at 14:22, Jiri Bobek via Std-Proposals
> <std-proposals_at_lists.isocpp.org> wrote:
> >
> > This should work the same way as include guards. Once the file is included, you don't include it second time.
>
> Oh, right, "_the_ file"..
>
> > Yes, utils.h may be a different file each time but that's irrelevant.
>
> ..which is multiple files for different utils.h incarnations, but yet
> the hash of a file doing that include may be the same.
>
> > Hash works 🙂
>
> No, it doesn't. And neither does #pragma once.
--
Std-Proposals mailing list
Std-Proposals_at_lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-09-23 12:22:21