From: neil AT robots DOT ox DOT ac DOT uk (Neil Townsend) Newsgroups: comp.os.msdos.djgpp Subject: Re: Optimizer and logical operators. Date: Fri, 4 Sep 1998 12:10:57 GMT Organization: None evident here. Message-ID: <1998Sep4.121057.1208@catorobots.ox.ac.uk> References: <4D580E8D0A378A4D DOT 13E50F10CD0F8074 DOT 909D1CC8A7C84CD0 AT library-proxy DOT airnews DOT net> NNTP-Posting-Host: cato.robots.ox.ac.uk NNTP-Posting-Date: 4 Sep 1998 12:11:03 GMT Originator: neil AT cato Lines: 32 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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: 1. The string is only space; p1 will point the the terminating chracter. 2. The string contains some non-space. The loop will terminate with p1 pointing to the character after the first non-space character (which will be a '\0' if the string if there is only one non-space character followed by a terminataing character. eg " \0" " abcx\0" "y\0" ^ ^ ^ Neil -- Neil Townsend +44 (1865) 273121 neil AT robots DOT ox DOT ac DOT uk