Newsgroups: comp.lang.c Path: utzoo!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps From: flaps@dgp.toronto.edu (Alan J Rosenthal) Subject: Re: Quote without comment on char constant expansion Message-ID: <8804161922.AA28542@explorer.dgp.toronto.edu> Organization: University of Toronto References: <4418@hoptoad.uucp> <3432@haddock.ISC.COM> <7677@brl-smoke.ARPA> <11056@mimsy.UUCP> <5206@ihlpg.ATT.COM> Date: Sat, 16 Apr 88 13:22:42 EDT I'm using the convention of quoting C statements with backquotes since I need to use forward-quotes and double-quotes. Discussing that there is no way to write the (revolting in my opinion) CTRL macro where `CTRL(a)` substitutes to `('a' & 037)`, tainter@ihlpg.ATT.COM first asks if `"ABCD"[0]` isn't indeed legal ANSI C (it is), and then assuming that it is says that `(#x[0])` >becomes a 'charize' expression equivalent to a direct charize operator >for all intents and purposes. I can't seriously imagine a compiler not >optimizing this expression to the character constant. The optimization is not the problem. What the problem is is that this is not a character constant, it is a character-valued expression. So where a constant expression is required this cannot be used. The most common example for the CTRL macro is a switch statement, in which the cases must be constant expressions. ajr -- ":= has got to be the most ugly, most bogus pile of sh*t ever invented, but that's my personal opinion." -- Johnson Noise