Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kEventParamPostTarget




On Jul 31, 2005, at 12:35 PM, Laurence Harris wrote:

On 7/31/05 1:46 PM, John Stiles didst favor us with:



If I were writing the framework/universal headers, that would have been

my choice.

And for the purist/pedantic among us, you could always do something

along the lines of


#if _cplusplus

const CFAllocatorRef kCFAllocatorDefault = NULL;

#else

#define kMyCFAllocatorDefault NULL



If I were going to use a macro, I'd define it like this:


#define kMyCFAllocatorDefault ((CFAllocatorRef)NULL)


This way you can't accidentally pass kMyCFAllocatorDefault in a parameter

that doesn't take a CFAllocatorRef. I know that's not likely to happen here,

but I'm a big advocate of consistently using good, defensive programming

practices as opposed to saying "Well, in *this* case I can just do [some

shortcut]."


I agree with that addition.
I use macros so rarely that I don't automatically think of tricks like that :)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: kEventParamPostTarget (From: Laurence Harris <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.