Re: Supporting Multiple SDK's Without Warnings
Re: Supporting Multiple SDK's Without Warnings
- Subject: Re: Supporting Multiple SDK's Without Warnings
- From: Greg Guerin <email@hidden>
- Date: Sun, 2 Jul 2006 11:40:52 -0700
Nick Nallick wrote:
>Given that for Xcode REQUIRE_PANTHER will also always evaluate as
>true this seems rather pointless, not to mention the fact that it's
>kind of the point of the whole thing. I really just want the
>compiler to shut up and optimize out everything but the function
>call. Can anybody suggest another way to do this without the warning?
Can you conditionally define macros for the functions?
Then you'd write all your source code like this:
QDGetPictureBounds(picHdl, &picFrame);
and it would either expand to the actual function call (or more likely, not
be defined as a macro at all in that case), or it would expand to this:
picFrame = (**picHdl).picFrame;
or more likely, given the constraints of macros:
*(&picFrame) = (**(picHdl)).picFrame;
Or define like this:
#if (YOUR_CONDITION_HERE)
#define MyPictBounds(hand,rect) (QDGetPictureBounds(hand,&(rect))
#else
#define MyPictBounds(hand,rect) (rect=(**(hand)).picFrame)
#endif
and use like this:
MyPictBounds(picHdl, picFrame);
DISCLAIMERS:
All code is for illustration purposes only; it has not been tested.
All the usual warnings for side-effects in macro args apply.
Assuming macros are technically feasible, there's still an ROI question.
It depends on how what the value of number is in "a number of patterns
similar to the one below", and exactly how many different functions are
referenced. If it's a few functions used many times, the payoff is good.
If it's many different functions, each one used a few times or only once,
defining a zillion single-user macros is a PITA.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden