Use of expression values in C

Vince Manis manis at ubc-cs.UUCP
Thu Jul 11 02:04:08 AEST 1985


I must agree with Henry Spencer that readability is not a Boolean type (I doubt
it's even an ordered type!). However, the question of embedded assignment is 
not entirely onesided. For some time, I have been using a construct which I
call a ``guarded command'' (and is indeed something vaguely like Dijkstra's
guarded commands):

      if ((fp = fopen(...) != NULL) {
         ... Do something; fp does indeed have a value ...
      }

The idea is that the if-statement protects the statements of the block. I 
find this an extremely readable way of stating constraints about the validity
of variables over sequences of code.



More information about the Comp.lang.c mailing list