From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avKLI-0006Yz-C5 for qemu-devel@nongnu.org; Wed, 27 Apr 2016 03:57:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avKLE-0002T8-BP for qemu-devel@nongnu.org; Wed, 27 Apr 2016 03:57:04 -0400 References: <1461119601-4936-1-git-send-email-david@gibson.dropbear.id.au> <1461119601-4936-2-git-send-email-david@gibson.dropbear.id.au> <571F4A36.7060106@redhat.com> <20160427060252.GB18476@voom.redhat.com> <87bn4v362f.fsf@dusky.pond.sub.org> <572064DF.6030802@redhat.com> <87potbzf0m.fsf@dusky.pond.sub.org> From: Thomas Huth Message-ID: <572070C6.5000304@redhat.com> Date: Wed, 27 Apr 2016 09:56:54 +0200 MIME-Version: 1.0 In-Reply-To: <87potbzf0m.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC for-2.7 01/11] qdt: IEEE1275-style device tree utility code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: David Gibson , aik@ozlabs.ru, agraf@suse.de, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, crosthwaite.peter@gmail.com On 27.04.2016 09:28, Markus Armbruster wrote: > Thomas Huth writes: >=20 >> On 27.04.2016 08:43, Markus Armbruster wrote: >>> David Gibson writes: >>> >>>> On Tue, Apr 26, 2016 at 01:00:06PM +0200, Thomas Huth wrote: >>>>> On 20.04.2016 04:33, David Gibson wrote: >> [...] >>>>>> +/* >>>>>> + * Property functions >>>>>> + */ >>>>>> + >>>>>> +QDTProperty *qdt_new_property(const gchar *name, gconstpointer va= l, gsize len) >>>>>> +{ >>>>>> + QDTProperty *prop =3D g_malloc0(sizeof(*prop) + len); >>>>>> + >>>>>> + prop->name =3D g_strdup(name); >>>>>> + prop->len =3D len; >>>>>> + memcpy(prop->val, val, len); >>>>>> + return prop; >>>>>> +} >>>>>> + >>>>>> +static QDTProperty *getprop_(const QDTNode *node, const gchar *na= me) >>>>> >>>>> Underscore at the end looks somewhat strange ... can't you simply d= rop that? >>>> >>>> Well.. the idea was that the _ versions are the "internal" ones, >>>> whereas external users will generally use the non-underscore version >>> >>> I've seen that convention used before. It's fine with me. >> >> Can't remember to have seen that convention before ... I know that som= e >> people use the underscore at the beginning to mark an internal functio= n, >> but at the end? >> So if you really want to use the underscore, what about putting it at >> the beginning instead? >=20 > C99 7.1.3 Reserved identifiers: >=20 > -- All identifiers that begin with an underscore are > always reserved for use as identifiers with file scope > in both the ordinary and tag name spaces. Oh, I always thought that underscore + lowercase letter would still be OK for local variables and functions, since for example http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html say= s: "In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (=E2=80=98_=E2=80=99) and all identifiers regard= less of use that begin with either two underscores or an underscore followed by a capital letter are reserved names" ... that sounds like the underscore rule only applies to global functions and variables (and to those where the underscore is followed by a capital letter or another underscore). But if I've got your quote right, a leading underscore _always_ indicates a reserved name for functions and variables, no matter whether they are local or global... Well, you learn something new every day :-) Thomas