Path: utzoo!attcan!utgpu!watmath!uunet!ginosko!shadooby!oxtrap!teemc!rphroy!tkacik From: tkacik@rphroy.UUCP (Tom Tkacik) Newsgroups: unix-pc.general Subject: another bug in /lib/cpp? Message-ID: <17953@rphroy.UUCP> Date: 12 Oct 89 01:18:46 GMT Organization: GM Research Labs, Warren, MI Lines: 29 I found another reason to use gcc-cpp instead of /lib/cpp. /lib/cpp will expand a macro with arguments even if none are given. (HuH?) For example: #define min(a,b) ((a)<(b)?(a):(b)) f() { int min; return min; } In the function f(), min should not be expanded because it is not followed by parenthesis. However, cpp on the 3b1 tries to expand it anyway with the error messages junk.c: 5: min: argument mismatch junk.c: 7: min: argument mismatch junk.c: 7: min: unterminated macro call Gcc-cpp gets this right. K&R1 say this is legal. No fair telling me I should not do this, I know that :-) -- --- Tom Tkacik GM Research Labs, Warren MI 48090 uunet!edsews!rphroy!megatron!tkacik Work Ph: (313)986-1442 "If you can't stand the bugs, stay out of the roach-motel." Ron Guilmette