rosenber@ra.abo.fi (Robin Rosenberg INF) (01/17/90)
>> >> if ((WinFont = (struct TextFont *) OpenFont (&ta)) == NULL && >> (WinFont = (struct TextFont *) OpenDiskFont (&ta)) == NULL) { >> Abort ("Can't open font\n"); >> } > >Well, I wouldn't do that either, because you can't be sure what the compiler >is going to do with your code. You've got two expressions hooked together >with a logical 'and' -- now which one will the final code try first? The one >on the right? Uh-oh. This is better: Anyone who knows C also knows that the logical operators && and || are GUARANTEED to evaluate left-right and only so far as to know the final result of the expression. I.e in "a && b", if a is false (0) the compiler knows that the expression is false and b isn't evaluated. If a is true b has to be evaluated to determine the value of the expression. This applies to C, C++ and Modula-2. ---------------- Robin Rosenberg