Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-unix!husc6!cmcl2!brl-adm!adm!kb5mu@pnet01.CTS.COM From: kb5mu@pnet01.CTS.COM Newsgroups: comp.lang.c Subject: Turbo C Preprocessor bug Message-ID: <7729@brl-adm.ARPA> Date: Sun, 7-Jun-87 06:05:07 EDT Article-I.D.: brl-adm.7729 Posted: Sun Jun 7 06:05:07 1987 Date-Received: Sun, 7-Jun-87 20:00:01 EDT Sender: news@brl-adm.ARPA Lines: 19 I still haven't bought Turbo C, but a friend reports a preprocessor bug. This code: #define ctrl(x) (x & 037) printf("ctrl(d) = %d\n", ctrl('d')); expands to: printf("ctrl(d) = %d\n", (ctrl & 037)); instead of the correct: printf("ctrl(d) = %d\n", ('d' & 037)); This happens with all flavors of the compiler, including the preprocessor-only version. [This is an ANSI-compatible version of the more traditional #define ctrl(x) ('x' & 037) printf("ctrl(d) = %d\n", ctrl(d)); The traditional form doesn't work either.] Paul Williamson ... sdcsvax!crash!pnet01!kb5mu or ... williams@macomw.arpa