Mail Archives: djgpp/1998/09/04/23:00:54
On Fri, 4 Sep 1998 12:10:57 GMT, Neil Townsend wrote:
>In comp.os.msdos.djgpp (SED AT ticnet DOT com) writes:
>>So I should be able to rewrite:
>>
>>while( (*p1 != '\0') && isspace( *p1 ) )
>> ++p1;
>>
>>as
>>
>>while( (*p1 != '\0') && isspace( *(p1++) ) );
>
>You could, but there would be a subtle change in functionality. In your
>original code, p1 was incremented if the string hadn't ended and it pointed
>to a spcae character. In the second line, p1 might be incremented one more
>time: If the string hasn't ended and p1 point to a non-space character it
>will still be incremented (because the increment is no longer conditional on
>the success of the second clause). The loop will end in one of two ways:
<snip>
>Neil
Oops!
On Thu, 03 Sep 1998 18:51:22 -0300, Endlisnis wrote:
> Yes. The optimizer should not change what your code does, just how it does
>it. There are some very rare cases (usually when you try something tricky)
>where the optimizer will get confused, but you shouldn't worry about these
>problems unless you experience them.
>--
> (\/) Endlisnis (\/)
Thanks for the info!
Matt Darland
- Raw text -