Assignment in test: OK?
Jeffrey T. Hutzelman
jh4o+ at andrew.cmu.edu
Sat Sep 8 00:21:00 AEST 1990
John,
Good idea; it works great as long as you aren't trying to compare 2
variables. However, I think the intent of the original code was to
perform an assignment and then do a test on the result (look carefully;
there's a > or < in there somewhere), similar to the following, which I
use all the time:
if ( ( file_ptr = fopen (filename, mode) ) == NULL )
{
/* print a message and exit */
}
-----------------
Jeffrey Hutzelman
America Online: JeffreyH11
Internet/BITNET:jh4o+ at andrew.cmu.edu, jhutz at drycas.club.cc.cmu.edu
>> Apple // Forever!!! <<
More information about the Comp.lang.c
mailing list