Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!decwrl!labrea!agate!pasteur!ames!nrl-cmf!cmcl2!brl-adm!adm!jbaker@ee.UCLA.EDU From: jbaker@ee.UCLA.EDU (Joe Baker) Newsgroups: comp.lang.c Subject: macros with parameters in MSC 5.0 Message-ID: <11879@brl-adm.ARPA> Date: 18 Feb 88 00:30:53 GMT Sender: news@brl-adm.ARPA Lines: 37 I am a C neophyte and am looking for a solution to the following problem: I am attempting to port the latest version of the public domain spreadsheet calculator, sc 5.1, to an IBM PC. I am using Microsoft C 5.0. The code uses the following macro to produce control characters for comparison to input characters in case statements and the like: #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. I have come up with some ugly fixes, but would like to know: what is the Right Way to do this? Thanks, - Joe Baker, Dept. of Electrical Engineering 6731 Boelter Hall, UCLA, L.A., CA 90024 (213) 825-7079, 825-2327 ARPA: jbaker@ee.ucla.edu UUCP: {ihnp4|randvax|ucbvax}!ucla-cs!uclaee!jbaker "Presumptions that the church should be trying to improve housing for the poor...that the church should be small and impoverished...are hidden presumptions that I see all the time. Are _you_ housing the homeless in your home? What's the Empire State Building doing to help the homeless...? Why should people just pick on the churches? There's a fairness element here." - Pastor of the Fifth Avenue Presbyterian Church in NYC