Re: strcpy - my implementation
- From: Old Wolf <oldwolf@xxxxxxxxxxxxxx>
- Date: Tue, 9 Sep 2008 01:16:10 -0700 (PDT)
On Sep 9, 5:34 pm, CBFalconer <cbfalco...@xxxxxxxxx> wrote:
Keith Thompson wrote:
if (c) { ... }
if (c != '\0') { ... }
I disagree. The (c) expression worries only about whether the
character is or is not something with a zero value. The (c !=
'\0') expression expressly converts that zeroness into either the
value 0 or the value 1 before testing. Optimization may affect
this.
I would normally expect the second expression to generate larger
code than does the first, with optimization disabled.
I don't know what you're smoking today, but
the above two if statements are exactly
equivalent in effect, and I challenge you
to come up with a compiler that generates
different code for them, let alone one that
actually causes a different code branch to
execute.
.
- Follow-Ups:
- Re: strcpy - my implementation
- From: CBFalconer
- Re: strcpy - my implementation
- References:
- strcpy - my implementation
- From: arnuld
- Re: strcpy - my implementation
- From: Richard Heathfield
- Re: strcpy - my implementation
- From: pete
- Re: strcpy - my implementation
- From: CBFalconer
- Re: strcpy - my implementation
- From: Richard Heathfield
- Re: strcpy - my implementation
- From: Richard
- Re: strcpy - my implementation
- From: pete
- Re: strcpy - my implementation
- From: Richard
- Re: strcpy - my implementation
- From: Keith Thompson
- Re: strcpy - my implementation
- From: CBFalconer
- strcpy - my implementation
- Prev by Date: Re: calling qsort
- Next by Date: Re: UNIX, C, Perl
- Previous by thread: Re: strcpy - my implementation
- Next by thread: Re: strcpy - my implementation
- Index(es):
Relevant Pages
|
Loading