Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Preprocessor macro to quote its argument Message-ID: <1990Aug26.002710.9343@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1112@mti.mti.com> <1114@mti.mti.com> <1990Aug20.012839.3545@zoo.toronto.edu> <11517@ogicse.ogi.edu> <1990Aug21.175138.24633@zoo.toronto.edu> <21594@grebyn.com> Date: Sun, 26 Aug 90 00:27:10 GMT In article <21594@grebyn.com> ckp@grebyn.UUCP (Checkpoint Technologies) writes: >Why can't this work? >#define CTRL(ch) ((* #ch) - 64) >Now, I know this *could* be a constant expression... 3.4 says that the value of an object may not be accessed by a `*' operator in a constant expression, so this isn't a constant expression in a portable sense. However, it is not a constraint violation, so the compiler is not *required* to complain about it, and 3.4 does explicitly authorize compilers to accept "other forms" of constant expression. So your comment is correct: it *could be* a constant expression, but isn't dependably one. Alas, one use of the `CTRL(D)' hack is in case labels, where constant expressions are required. -- Committees do harm merely by existing. | Henry Spencer at U of Toronto Zoology -Freeman Dyson | henry@zoo.toronto.edu utzoo!henry