[comp.lang.c] && operator

gwyn@smoke.BRL.MIL (Doug Gwyn) (08/19/89)

In article <20348@sequent.UUCP> paulr@crg3.UUCP (Paul Reger) writes:
-while ((ch = getchar()) != EOF && ch != '\n')
-Is there any assurance in any C standard that the left expression will
-always be evaluated first, with the right following it ??  I mean for
-purposes of optimization, the right should be evaluated first, unless
-there is something in some standard somewhere limiting such
-optimizations...

Any introductory C textbook will tell you how the && operator works.
Certainly the standard reflects the way the operator has always been
defined.  (I'm refraining from simply answering the question, because
I think you should find such a textbook and study it.)

-I'm from Ada-land where such problems are handled by the 'and then'
-clause.

Whoopee do.

It's not a problem.