🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5723

defined operator

#5723
From: James Jones
Date: Wed, 15 Feb 1989 18:40
25 lines
1346 bytes
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
Technical Details
Message-ID: <954@mcrware.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcrware!jejones

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcrware!jejones
From: jejones@mcrware.UUCP (James Jones)
Newsgroups: comp.std.c
Subject: defined operator
Keywords: "preprocessing", macro replacement, defined
Message-ID: <954@mcrware.UUCP>
Date: 15 Feb 89 18:40:27 GMT
Distribution: usa
Organization: Microware Systems Corp., Des Moines, Ia.
Lines: 25