From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] HACKING: remove bogus restrictions
Date: Tue, 28 Aug 2012 20:18:32 +0300 [thread overview]
Message-ID: <20120828171832.GA3661@redhat.com> (raw)
In-Reply-To: <CAFEAcA9k5zX2-t=Gy25hM7f7-n0kRtUy+qtKqOTQRxOygrLGDA@mail.gmail.com>
On Tue, Aug 28, 2012 at 05:24:40PM +0100, Peter Maydell wrote:
> On 28 August 2012 17:01, Michael S. Tsirkin <mst@redhat.com> wrote:
> > We copied HACKING from libvirt but it has some bogus stuff:
> > neither underscore capital, double underscore, or underscore 't' suffixes
> > are reserved in Posix/C: this appears to be based on misreading of the
> > C standard. Using sane prefixes is enough to avoid conflicts.
> > -2.4. Reserved namespaces in C and POSIX
> > -Underscore capital, double underscore, and underscore 't' suffixes should be
> > -avoided.
>
> I think this is just a missing "prefixes". C99 7.1.3
> reserves underscore capital and double underscore prefixes.
This is taking it out of context - reserved means different
things in different parts of the spec.
As far as I can see, 7.1.3 talks about what is permissible in headers:
naturally when a libc implementation adds stuff in a header it would
want to avoid breaking applications including this header. But
it does not talk about what is permissible in a legal program - to avoid
conflicts, you just need to use variables with reasonable names like
kvmXXX qemuXXX or virtioXXX.
So it does not look like this is a reason to not use __kvm_pv_eoi_disabled.
Chances that a libc header predefines this name are zero.
> POSIX reserves _t if any POSIX header is defined (POSIX.1-2008 section
> 2.2.2, http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html)
Same thing really.
So this says posix implementations can add types ending with _t in any
header. It does not prohibit applications from using such names
in a reasonable manner, and it does not look like this is a reason to
not use qemu_foo_bar_t.
> I would suggest that the section is reworded to:
>
> # Underscore capital and double underscore prefixes are reserved
> # by the C standard. Underscore 't' suffixes are reserved by POSIX.
> # They should be avoided in QEMU code.
>
> -- PMM
This might be nice from language purism point of view
but ignores the fact that QEMU already uses lots of these.
Specifically a _t type is even mentioned in HACKING itself.
So the benefit to excluding this in new code is marginal.
--
MST
next prev parent reply other threads:[~2012-08-28 17:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-28 16:01 [Qemu-devel] [PATCH] HACKING: remove bogus restrictions Michael S. Tsirkin
2012-08-28 16:07 ` Michael S. Tsirkin
2012-08-28 16:24 ` Peter Maydell
2012-08-28 17:18 ` Michael S. Tsirkin [this message]
2012-08-28 17:23 ` Peter Maydell
2012-08-28 17:32 ` Michael S. Tsirkin
2012-08-28 17:46 ` Peter Maydell
2012-08-28 18:00 ` Michael S. Tsirkin
2012-08-28 17:27 ` malc
2012-08-28 17:13 ` Blue Swirl
2012-08-28 17:21 ` Michael S. Tsirkin
2012-08-28 17:25 ` Blue Swirl
2012-08-28 17:27 ` Peter Maydell
2012-08-28 17:33 ` malc
2012-08-28 17:35 ` Michael S. Tsirkin
2012-08-28 17:34 ` Michael S. Tsirkin
2012-08-28 17:33 ` Andreas Färber
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=20120828171832.GA3661@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).