C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Revising #pragma once

From: Jiri Bobek <jiri.bobek_at_[hidden]>
Date: Mon, 23 Sep 2024 14:01:57 +0200
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_[hidden]> wrote:
>
> On Mon, 23 Sept 2024 at 14:22, Jiri Bobek via Std-Proposals
> <std-proposals_at_[hidden]> 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.

Received on 2024-09-23 12:02:10