From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6PPv-0005iz-DY for qemu-devel@nongnu.org; Tue, 28 Aug 2012 13:17:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6PPp-0005jm-Gt for qemu-devel@nongnu.org; Tue, 28 Aug 2012 13:17:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6PPp-0005jg-7B for qemu-devel@nongnu.org; Tue, 28 Aug 2012 13:17:25 -0400 Date: Tue, 28 Aug 2012 20:18:32 +0300 From: "Michael S. Tsirkin" Message-ID: <20120828171832.GA3661@redhat.com> References: <20120828160116.GA3047@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] HACKING: remove bogus restrictions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Blue Swirl , Anthony Liguori , qemu-devel@nongnu.org, Stefan Hajnoczi On Tue, Aug 28, 2012 at 05:24:40PM +0100, Peter Maydell wrote: > On 28 August 2012 17:01, Michael S. Tsirkin 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