From: Al Viro <viro@zeniv.linux.org.uk>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: #pragma once (was Re: incoming)
Date: Mon, 1 Mar 2021 20:29:02 +0000 [thread overview]
Message-ID: <YD1OjvWcal+rPz+4@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <YDl9/QU8EsCOPyuf@localhost.localdomain>
On Sat, Feb 27, 2021 at 02:02:21AM +0300, Alexey Dobriyan wrote:
> There are rules and schemes about how to create guard macro.
>
> Should it be prefixed by underscore?
> Should it be prefixed by two underscores?
> Should it be full path uppercased or just last path component?
> Should the guard macro be lowercased?
> Should it be changed when header is moved?
> Should trailing #endif contain comment?
> Should #define be just #define or "#define FOO 1"?
Who cares? To all of the above, really.
> I've even seen advice (or an IDE doing that) that is should contain
> timestamp of a header creation time to minimise collisions (implying
> collisions could happen as could typos as could broken guards)
Ever seen that in the tree? Where, if so?
> All this zoo of styles and made up mental work is completely avoided
> by using #pragma once:
>
> 1) put #pragma once on the first line
>
> or
>
> 2) put #pragma once on the second line after SPDX banner
>
> and that's it.
>
> No fuss, no filled up preprocessor hashtables, no implicit arguing
> about styles.
Care to provide some stats on the amount of those macros encountered
on build, along with the total amount of defines parsed and hashed?
It's noise.
And what is "implicit arguing", BTW? I'm yet to see any fights
along those lines - you are the first one to bring that up, AFAICS.
Maybe I'd simply been lucky until now, of course, but...
prev parent reply other threads:[~2021-03-02 7:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 20:17 Alexey Dobriyan
2021-02-26 21:53 ` Linus Torvalds
2021-02-26 23:02 ` Alexey Dobriyan
2021-03-01 16:52 ` David Laight
2021-03-01 20:29 ` Al Viro [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YD1OjvWcal+rPz+4@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®