Standard Clarification

John Schwabacher johnsc at microsoft.UUCP
Wed Oct 25 04:15:21 AEST 1989


In article <1989Oct21.233915.23217 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
}In article <23218 at cup.portal.com> Tim_CDC_Roberts at cup.portal.com writes:
}> ... ["#define d define" example removed]
}>MSC complains that "d" is an unknown preprocessor directive and aborts.
}>Does the standard require that this construct should compile correctly?
} ... [ANSI spec removed]
}In other words, ANSI C specifically says that it *doesn't* work.
}
}>    #define abcde getchar
}>           ...
}>      ch = abcde();
}>
}>The preprocessor substituted 'getchar' for 'abcde', but then failed to
}>expand the 'getchar()' macro from stdio...
}
}Unless I have missed some fine point, your preprocessor is wrong again.
}This is legal.
}

Wait a minute. "Wrong again"?  You just said MSC got the first one right.

When I tried the "#define abcde getchar" using MSC 5.10, it worked fine.
I don't have 5.0 handy, so I can't say about that.

*None* of the Obscure C contest winners that I tried to build under Xenix
worked correctly.  Bummer.



More information about the Comp.lang.c mailing list