• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Custom macros as a loop break conditional?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: autorelease use...
  • Next by Date: Re: Special Borders
  • Previous by thread: Re: autorelease use...
  • Next by thread: checking for clipping by other windows
  • Index(es):
    • Date
    • Thread