Assignment in test: OK?

Mark Lawrence mark at DRD.Com
Wed Sep 26 22:41:55 AEST 1990


jh4o+ at andrew.cmu.edu (Jeffrey T. Hutzelman) wrote:
} [...] 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 */
} 	}

right.  I posted the original article.  The most severe caution I got
was about readability.  My concern was that Saber C would give a warning
on code just like the above and I've learned to take Saber's warnings
seriously.  In this case, I'll just suppress the warning.  Thanks, all,
for an illuminating thread of discussion.
-- 
mark at DRD.Com uunet!apctrc!drd!mark$B!J%^!<%/!!!&%m!<%l%s%9!K(B



More information about the Comp.lang.c mailing list