Path: utzoo!mnetor!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c Subject: Re: macros with parameters in MSC 5.0 Message-ID: <223@sdrc.UUCP> Date: 19 Feb 88 00:27:19 GMT References: <11879@brl-adm.ARPA> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 24 In article <11879@brl-adm.ARPA>, jbaker@ee.UCLA.EDU (Joe Baker) writes: < #define ctl(c) ('c'&037) < < This requires parameter substitution within a character constant, which < is not allowed in MSC5.0 (My reading of Kernighan & Ritchie pg. 207 < seems to indicate that they don't allow it either. However, the < program compiles and runs on lots of systems.) < < The Microsoft manual suggests use of the 'stringizing' operator, #, < but this produces a string literal instead of a character constant. Just stringize and then pick the character you want out of the string: #define ctl(c) (#c[0]&037) A sufficiently clever compiler will just compile this into a character constant. -- ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC MAIL: 2000 Eastman Dr., Milford, OH 45150 AT&T: (513) 576-2070 "When all else fails, read the directions."