#define void int vs. #define void char
Arthur David Olson
ado at elsie.UUCP
Sun Jun 12 01:38:39 AEST 1988
A response to an earlier article of mine convinces me that I failed to be
clear and succinct. Let me try again.
QUESTION 1.
What's an example of code that compiles but does the wrong thing if you
#define void int
?
QUESTION 2.
What's an example of code that compiles but does the wrong thing if you
#define void char
?
==============================================================================
Here are my best answers so far:
ANSWER 1.
The code
extern void * malloc();
char * getten() { return malloc(10); }
on machines where (int *) != (char *).
ANSWER 2.
I know of no such code.
==============================================================================
If you have better answers, I'd appreciate hearing from you.
--
ado at ncifcrf.gov ADO is a trademark of Ampex.
More information about the Comp.lang.c
mailing list