CTRL(X) in ANSI standard
Arthur David Olson
ado at elsie.UUCP
Wed May 29 00:35:55 AEST 1985
In regard to
#define CTRL(XX) ( (#XX)[0] & '\037')
in article <507 at ucsfcgl.UUCP>, arnold at ucsfcgl.UUCP (Ken Arnold%CGL) writes:
> . . .Unless the compiler is incredibly smart, this won't work in 'case'
> statements, which is rather important. . .
> Actually, when you think about it, since strings are writeable, "a"[0]
> is NOT a constant, since someone else might modify the string. . .
Although if I understand aright the draft standard treats unadorned doubly-
quoted strings as if they were cast to "const", which means that constructs
like "a"[0] would be constants under the draft standard.
As for me, I still favor the
#define Ctrl(X) ((X) & '\037')
approach. Change your source once and be done with it.
--
Ken is a Kenner Corporation trademark.
--
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado at seismo.ARPA
DEC, VAX and Elsie are Digital Equipment and Borden trademarks
More information about the Comp.lang.c
mailing list