defined operator

James Jones jejones at mcrware.UUCP
Thu Feb 16 04:40:27 AEST 1989


I'm somewhat confused about the discussion of the defined operator (3.8.1
et seq.).  Suppose one has the following sequence of directives:

	#define woof(x) x ## 5
	#if defined woof(z)
		<etc.>
	#endif

This would seem to be either

1. valid, and the text between #if and #endif will be processed if z5 is
   defined
2. invalid, because the text following #if will look like 1(z), which is
   not a well-formed expression

but I'm not sure which it is, even after going into pilpul mode.  If someone
can tell me what should happen according to X3J11 Draft, and why, I'd be much
obliged.  Summary will follow if interest is expressed, of course.

(Come to think of it, wasn't it forbidden to define "defined" in an earlier
draft?  If it still is, I don't see where it is; I can understand such a
restriction being removed, since someone might have used "defined" as an
identifier...)

		James Jones



More information about the Comp.std.c mailing list