Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!cornell!batcomputer!braner From: braner@batcomputer.tn.cornell.edu (braner) Newsgroups: comp.sys.atari.st Subject: Laser C bug Message-ID: <4057@batcomputer.tn.cornell.edu> Date: 15 Mar 88 21:42:00 GMT Reply-To: braner@tcgould.tn.cornell.edu (braner) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 25 Summary: Preprocessor #if can't take "||" [] The Laser C preprocessor will not take a logical OR, as in: #define AtST 1 #define MSDOS 0 ... #if (AtST || MSDOS) /* does not work! */ The solution is to write: #if (AtST | MSDOS) /* this does work */ Note that the replacement of logical OR with a bit-wise OR is safe, but one CANNOT generally replace "&&" with "&". For example: (2 && 4) == 1, but (2 & 4) == 0. I consider this a bug since in "C: A Reference Manual" by Harbison & Steele (highly recommended, look for 2nd edition!) it says explicitly that "||" is OK in the constant expression for #if. - Moshe Braner PS: Havn't received the Laser C manual yet. I sent the defective Laser C system disk I got back to Megamax, and they sent me a replacement already.