#defines with parameters [was :Re: v05i053: A "safe" ... ]

T. William Wells bill at twwells.uucp
Sun Nov 27 17:09:55 AEST 1988


In article <264 at aber-cs.UUCP> pcg at cs.aber.ac.uk (Piercarlo Grandi) writes:
: Now I have always had a low opinion of the X3J11 work (e.g. not to
: realize that unsigned and int are different types, as they obey
: different rules for arithmetic, and char short and long are just
: range/length modifiers, and not the other way round), but this last
: idea really leaves me gasping...
:
: Obviously there must me a way to distinguish between macro bodies that
: begin with a "(" and macro definitions with a parameter list, is there
: one ?

Judging by this evidence, your opinion of X3J11 is based on
misinformation.

Firstly, they do indeed have unsigned and ints as different types.
(And I can't figure out whatever you meant by `char short', etc.  but
they haven't really changed anything there either.)

Secondly, they have done nothing to change the way that parentheses
are used when defining a macro.  A macro with arguments gets defined
with:

	#define <name>(<argument>) <body>

where either <argument> or <body> may be null. White space must not
appear between the <name> and the open parenthesis.  A macro with no
arguments get defined with:

	#define <name> <body>

and there must be white space between <name> and <body>.

---
Bill
{uunet|novavax}!proxftl!twwells!bill



More information about the Comp.lang.c mailing list