[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wi54DEScexxpMrO+Q2Nag_Tup+Y5YBHc_9_xGLeRfP8pA@mail.gmail.com>
Date: Sun, 28 Feb 2021 12:00:22 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Sparse Mailing-list <linux-sparse@...r.kernel.org>
Subject: Re: [PATCH 00/11] pragma once: treewide conversion
On Sun, Feb 28, 2021 at 11:34 AM Alexey Dobriyan <adobriyan@...il.com> wrote:
>
> >
> > End result: #pragma is fundamentally less reliable than the
> > traditional #ifdef guard. The #ifdef guard works fine even if you
> > re-read the file for whatever reason, while #pragma relies on some
> > kind of magical behavior.
You continue to not even answer this very fundamental question.
"#pragma once" doesn't seem to have a _single_ actual real advantage.
Everybody already does the optimization of not even opening - much
less reading and re-parsing - headers that have the traditional #ifdef
guard.
And even if you _don't_ do that optimization, the #ifdef guard
fundmentally semantically guarantyees the right behavior.
So the #ifdef guard is
(a) standard
(b) simple
(c) reliable
(d) traditional
and you have yet to explain a _single_ advantage of "#pragma once".
Why add this incredible churn that has no upside?
So no. We're not using #pragma once unless y9ou can come up with some
very strong argument for it
And no, having to come up with a name for the #ifdef guard is not a
strong argument. It's simply not that complicated.
Linus
Powered by blists - more mailing lists