vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| My copy of Kernighan & Ritchie, 2nd edition, has 4 entries in the index for the && operator, and they ALL make specific mention that left to right order of evaluation for the && and || operators is guaranteed. Less emphasis is given to the equally important fact that evaluation of the expression is stopped "as soon as truth or falsehood is known". The book comments: "Most C programs rely on these properties." On Fri, Feb 13, 2004 at 05:43:50PM +0100, Ed White wrote: > On Friday 13 February 2004 17:32, Ed White wrote: > > if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { > > Little note: the code works only if the compiler build the executable keeping > the same checks order > > 1) place[1] != '\0' > 2) *++place == '-' > 3) place[1] == '\0' > > > I've always read that it shouldn't be trusted so much... |