🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.objective-c
Article #404

Hole in preprocessor support of Obj-C?

#404
From: Josh DuBois
Date: Tue, 15 Apr 1997 00:00
43 lines
2074 bytes
	Hey, there -

		someone here just noticed what looks to me like a hole in  
gcc's preprocesor support for Obj-C.  We're trying to implement a macro  
for exception raising - we'd like to do something like :


#define ERROR(errorType, errorString) \
[NSException raise:errorType\
			format:[NSString stringWithFormat:@"%@ at %s :  
%d", \
				errorString, __FILE__, __LINE__]]


	where errorType is one of something like

#define ERRORTYPE1 @"ErrorTypeOne"

	and errorString is an NSString*.  The problem is that sometimes  
I'd like to say

		ERROR(ERRORTYPE1, [NSString stringWithFormat:@"foo : %@",  
[self bar]])

	so I can pass a string generated with printf-style formatting.   
The problem is that the preprocessor chokes with something like :

/CashierPayment.m:209: macro `ISLogError' used with too many (3) args

	apperantly concerned about the two commas, despite the fact that  
one of them is, in reality, part of an expression that should (IMHO) be  
treated as a single macro argument.

	part of my problem may be that I'm using gcc 2.5.8  - does anyone  
know if this problem has been fixed in more recent versions?  (also, as  
may be clear from my examples, I'm on a NeXT).  Am I missing something in  
wanting this feature - i.e., is this not a *bug,* but a necessity for some  
reason?

		Thanks for any help,

				Josh.
Technical Details
Message-ID: <5j117u$oe6@medusa.is.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,30fc78d511a0d982,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: f9256,30fc78d511a0d982,start
X-Google-Attributes: gidf9256,public
X-Google-Thread: 14ede5,30fc78d511a0d982,start
X-Google-Attributes: gid14ede5,public
X-Google-Thread: 1111a3,30fc78d511a0d982,start
X-Google-Attributes: gid1111a3,public
From: duboisj@gondolin.is.com (Josh DuBois)
Subject: Hole in preprocessor support of Obj-C?
Date: 1997/04/15
Message-ID: <5j117u$oe6@medusa.is.com>
X-Deja-AN: 235059546
Organization: Integrity Solutions, Inc.
Newsgroups: comp.lang.objective-c,comp.sys.next.programmer,gnu.gcc.help,gnu.gcc.bugs