Custom macros as a loop break conditional?
Custom macros as a loop break conditional?
- Subject: Custom macros as a loop break conditional?
- From: Ken Tozier <email@hidden>
- Date: Mon, 18 Jul 2005 10:30:46 -0400
I've never used macros in my own code but have encountered a
situation in a complex parsing class that might be a good fit for one.
I read up a little on creating macros but the sites I looked all
strongly discourage their use as it can be very hard to track down bugs.
Would the following snippet be a good candidate for one? if so, how
would it be done? Is it possible to imbed a "break" command in a
macro and have it work in a loop?
if (*s == ')')
{
s++;
break;
}
if possible, I'd like to generalize it so that the right side could
be a variable. Something like this function
inline BOOL EqualsDelimiter(unichar **inChar, unichar inDelim)
{
if (**inChar == inDelim)
{
*inChar++;
return YES;
}
return NO;
}
// usage
if (EqualsDelimiter(&s, delim)) break;
Thanks
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden