lied@ihlts.UUCP (Bob Lied) (06/29/85)
Regarding the debate about nesting assignments in if statements, such as
if ( (fp = fopen("foo", "r")) != NULL )
I prefer to make the assignment separate for the simple reason that
it gives me a place to set a breakpoint and test an alternate value
before the program decides what path to take. It's not quite so
useful in 'if' statements, but before a switch it comes in very handy.
For example,
c = getchar();
switch ( c ) switch ( c = getchar() )
In the example on the left, I can examine c before the program goes on,
and I can change it if I need to test a strange case; on the right,
I have to depend on the input data.
Bob Lied ihnp4!ihlts!lied