Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!geacc022%timevx@CIT-HAMLET.ARPA From: geacc022%timevx@CIT-HAMLET.ARPA Newsgroups: net.lang.c Subject: Assignments in conditionals Message-ID: <11576@brl-tgr.ARPA> Date: Mon, 15-Jul-85 11:12:48 EDT Article-I.D.: brl-tgr.11576 Posted: Mon Jul 15 11:12:48 1985 Date-Received: Wed, 17-Jul-85 06:47:20 EDT Sender: news@brl-tgr.ARPA Lines: 24 There is one place where the "if ((fp = fopen()) == NULL)" syntax is very useful, and that is in a series of "else if"'s. If you can keep your else if's lined up, the code looks a lot neater (and is generally easier to read). to wit: if (something) { ... } else if ((fp = fopen()) == NULL) { ... } else if ((fp2 = fopen()) == NULL) { ... } Try writing the equivalent code without assignments in conditionals, and you'll see what I mean. Once you have written a few programs like this, this form becomes at least as easy to read as two separated statements. Gary Ansok geacc022%timevx @ cit-hamlet.arpa (for the moment, anyway)