All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
	Konrad Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [Xen-devel] [PATCH] cmdline: treat hyphens and underscores the same
Date: Mon, 9 Dec 2019 15:11:09 +0100	[thread overview]
Message-ID: <359882b9-e6a4-508e-d339-841a021efa09@suse.com> (raw)
In-Reply-To: <fee3e4ec-213b-c3a9-a509-a125877be6f3@citrix.com>

On 09.12.2019 15:06, George Dunlap wrote:
> On 12/6/19 4:42 PM, Jan Beulich wrote:
>> On 06.12.2019 17:20, Julien Grall wrote:
>>> Hi,
>>>
>>> On 06/12/2019 16:06, Jan Beulich wrote:
>>>> On 06.12.2019 15:46, Julien Grall wrote:
>>>>> On 05/12/2019 16:50, Jan Beulich wrote:
>>>>>> On 05.12.2019 17:27, Julien Grall wrote:
>>>>>>> On 05/12/2019 15:33, Jan Beulich wrote:
>>>>>>>> +/*
>>>>>>>> + * String comparison functions mostly matching strcmp() / strncmp(),
>>>>>>>> + * except that they treat '-' and '_' as matching one another.
>>>>>>>> + */
>>>>>>>> +static int _strcmp(const char *s1, const char *s2)
>>>>>>>
>>>>>>> I thought we were trying to avoid new function name with leading _?
>>>>>>
>>>>>> We're trying to avoid new name space violations. Such are
>>>>>> - identifiers starting with two underscores,
>>>>>> - identifiers starting with an underscore and an upper case letter,
>>>>>> - identifiers of non-static symbols starting with an underscore.
>>>>>
>>>>> I am not sure to understand why non-static symbols only. This would
>>>>> prevent you to use the the non-static symbol if you happen to re-use the
>>>>> same name.
>>>>
>>>> I'm afraid I don't understand. Anyway - what I've listed above is
>>>> what the language standard mandates.
>>> AFAIU, for a given unit, there is only one pool of identifiers. So you 
>>> could not have an identifier used at the same time by a non-static and a 
>>> static symbol (that's exclusing the weak attribute). So it feels 
>>> slightly strange to only cover the non-static symbols.
>>
>> I guess I'm still not getting your point. What the above tells
>> us is that static symbols may start with an underscore (but
>> not followed by another one or an uppercase letter). Non-static
>> symbols may not.
>>
>>>>> Anyway, how about calling it cmdline_strncmp()? This would be easier to
>>>>> spot misuse on review (i.e using strncmp() rather than _strncmp()).
>>>>
>>>> We already have cmdline_strcmp(), or else I would indeed have used
>>>> this prefix. No prefix (other than the lone underscore) seemed the
>>>> next best option.
>>>
>>> As we parse an option, how about opt_strncmp()?
>>
>> I'd still like _strncmp() better here.
> 
> Why?  It doesn't tell you anything at all about what's special about the
> function.  In fact, I'd say it's confusing -- the "_" doesn't normally
> mean, "do something different and special", but "do the core of
> something which other things might call".
> 
> I'd much prefer opt_strncmp() than _strncmp().

Noted - will do.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2019-12-09 14:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 15:33 [Xen-devel] [PATCH] cmdline: treat hyphens and underscores the same Jan Beulich
2019-12-05 16:27 ` Julien Grall
2019-12-05 16:50   ` Jan Beulich
2019-12-06 14:46     ` Julien Grall
2019-12-06 15:18       ` George Dunlap
2019-12-06 16:06       ` Jan Beulich
2019-12-06 16:20         ` Julien Grall
2019-12-06 16:42           ` Jan Beulich
2019-12-06 16:45             ` Julien Grall
2019-12-09 14:06             ` George Dunlap
2019-12-09 14:11               ` Jan Beulich [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=359882b9-e6a4-508e-d339-841a021efa09@suse.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.