Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!necntc!ames!amdcad!sun!oliveb!pyramid!prls!gardner From: gardner@prls.UUCP (Robert Gardner) Newsgroups: comp.lang.c Subject: Portability and /**/ Message-ID: <4983@prls.UUCP> Date: Thu, 16-Jul-87 12:40:19 EDT Article-I.D.: prls.4983 Posted: Thu Jul 16 12:40:19 1987 Date-Received: Sat, 18-Jul-87 08:43:55 EDT References: <949@oakhill.UUCP> <23575@sun.uucp> Reply-To: gardner@prls.UUCP (Robert Gardner) Organization: Philips Research Labs, Sunnyvale, California Lines: 24 We recently received a large amount of code written for our Unix VAX in C. It's device driver routines make extensive use of an interesting construct -- a rather large number of #defines are of the form: #define a(n) a/**/n so that, for instance, a(2) expands to a2. (Someone tried to tell me that /**/ was a special c concatenation operator!:) This somehow made it easier to write code for many devices -- you choose the device you have, include its header, and compile. I seem to remember, though I can't find it, that K&R says that comments can occur anywhere white space is allowed, which suggests that this construct should not work. In pursuing this (out of curiosity), I found that the Ultrix VAX c compiler compiles the program main() { int n2=2; printf("%d\n",n/*comment*/2); } and prints out '2' when executed. This suggests that the pre-processor simply removes comments, rather than replacing them with white space. My Lightspeed C compiler at home will not compile the above program. Any comments on portability? Robert Gardner