Use of expression values in C
M.RINDSBERG
mr at hou2h.UUCP
Sat Jul 13 00:03:38 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) {
^
|--------- Missing close paren.
This one sure is guarded, it wont even compile (>:) .
> ... 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.
mark
..!hou2h!mr
More information about the Comp.lang.c
mailing list