Using strings as immediate char

karl at haddock karl at haddock
Mon Aug 25 05:59:00 AEST 1986

sun!guy (Guy Harris) writes:
>(The real test, of course, is whether
>        cmdchr = menu_selection["rofq"];
>yields the same result.  Any compiler that doesn't produce object code that
>yields the same result isn't a C compiler.)

True, and still true in ANSI C, though I'm still not sure why.  Is there any
valid reason for writing such a mess?  I think it ought to be deprecated, or
even completely illegal (but available, of course, as a "common extension" on
"some compilers").

No, not just for aesthetic reasons.  It makes it easier to define arrays as a
real datatype in future implementations if "x[y]" is redefined slightly.

Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint

More information about the Comp.lang.c mailing list