Hi all!
On Mit, 2013-10-30 at 12:41 -0700, Joe Perches wrote:
[...]
> The arch/... assembly versions don't always
> return -1, 0, 1 so I don't think it's worth
> it to change all of those.
FWIW user-space strcmp() - e.g. as in
http://pubs.opengroup.org/onlinepubs/009695399/functions/strcmp.html
Hi all!
On Mit, 2013-10-30 at 12:41 -0700, Joe Perches wrote:
[...]
The arch/... assembly versions don't always
return -1, 0, 1 so I don't think it's worth
it to change all of those.
FWIW user-space strcmp() - e.g. as in
http://pubs.opengroup.org/onlinepubs/009695399/functions/strcmp.html but
On Wed, 2013-10-30 at 20:35 +0100, Peter Hüwe wrote:
> Hi Joe, Jason
Hi Peter.
> > lib/string.c:strcmp returns only -1,0,1
> > so that's what the arch versions should do too.
> > However, arch implementations do vary...
[]
> I did not pay attention to where cscope did send me
> - it was
Hi Joe, Jason
> fyi: using
> if (strcmp(foo, bar) < 0)
> is canonical.
Yeah of course you're both right -
if (strcmp(foo, bar) < 0)
is the correct version.
Sorry about the rubbish patch.
> lib/string.c:strcmp returns only -1,0,1
> so that's what the arch versions should do too.
>
On Wed, Oct 30, 2013 at 01:40:27AM +0100, Peter Huewe wrote:
> strcmp does return the difference between two strings not only -1,0,1
> consequently
> if (strcmp (a,b) == -1)
> might lead to taking the wrong branch
>
> -> compare with <= instead.
I've always thought this was the preferred idiom:
On Wed, Oct 30, 2013 at 01:40:27AM +0100, Peter Huewe wrote:
strcmp does return the difference between two strings not only -1,0,1
consequently
if (strcmp (a,b) == -1)
might lead to taking the wrong branch
- compare with = instead.
I've always thought this was the preferred idiom:
Hi Joe, Jason
fyi: using
if (strcmp(foo, bar) 0)
is canonical.
Yeah of course you're both right -
if (strcmp(foo, bar) 0)
is the correct version.
Sorry about the rubbish patch.
lib/string.c:strcmp returns only -1,0,1
so that's what the arch versions should do too.
However,
On Wed, 2013-10-30 at 20:35 +0100, Peter Hüwe wrote:
Hi Joe, Jason
Hi Peter.
lib/string.c:strcmp returns only -1,0,1
so that's what the arch versions should do too.
However, arch implementations do vary...
[]
I did not pay attention to where cscope did send me
- it was
On Wed, 2013-10-30 at 01:40 +0100, Peter Huewe wrote:
> strcmp does return the difference between two strings not only -1,0,1
> consequently
> if (strcmp (a,b) == -1)
> might lead to taking the wrong branch
>
> -> compare with <= instead.
lib/string.c:strcmp returns only -1,0,1
so that's what
strcmp does return the difference between two strings not only -1,0,1
consequently
if (strcmp (a,b) == -1)
might lead to taking the wrong branch
-> compare with <= instead.
This also makes the code/behavior compliant with its comments.
(e.g. if PPI Version is 1.0)
Fixes Coverity complaints:
strcmp does return the difference between two strings not only -1,0,1
consequently
if (strcmp (a,b) == -1)
might lead to taking the wrong branch
- compare with = instead.
This also makes the code/behavior compliant with its comments.
(e.g. if PPI Version is 1.0)
Fixes Coverity complaints:
CID:
On Wed, 2013-10-30 at 01:40 +0100, Peter Huewe wrote:
strcmp does return the difference between two strings not only -1,0,1
consequently
if (strcmp (a,b) == -1)
might lead to taking the wrong branch
- compare with = instead.
lib/string.c:strcmp returns only -1,0,1
so that's what the arch
12 matches
Mail list logo