Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!necntc!ames!amdcad!amd!markg From: markg@amd.UUCP Newsgroups: comp.lang.c Subject: Re: Turbo C Preprocessor bug Message-ID: <4089@amd.UUCP> Date: Mon, 8-Jun-87 13:01:45 EDT Article-I.D.: amd.4089 Posted: Mon Jun 8 13:01:45 1987 Date-Received: Wed, 10-Jun-87 05:00:44 EDT References: <7729@brl-adm.ARPA> Reply-To: markg@amd.UUCP (Mark Gorlinsky) Organization: Advanced Micro Devices Lines: 26 In article <7729@brl-adm.ARPA> kb5mu@pnet01.CTS.COM (Paul Williamson) writes: - 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 is only a bug in the CPP.EXE program. TCC.EXE does not use this pre- processor. -This happens with all flavors of the compiler, including the -preprocessor-only version. I attempted to reproduce the same problem using TCC/TC.EXE. The program compiled and executed correctly. Using your example, the program printed 4. Sorry to say that TCC.EXE can't produce a preprocessor pass output file so we could see what really happens, but you can look at the .ASM file. -- Mark Gorlinsky - AMD Processor Products Division/APPS SQA UUCP: {decwrl,ihnp4,allegra}!amd!markg AT&T: (408) 982-7811 DISCLAIMER: My opinions are mine, not my employers.