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: Passing too many parameters to a function?



In message <email@hidden>, Uli Kusterer writes:
>  Does that mean it's actually safe to do this after all, under these  
>limited circumstances? I originally thought so, as I actually once  
>managed to call a function with too many parameters (it was a  
>horrible mess of typecasts -- don't ask, I was young and needed the  
>experience) and it didn't blow up in my face right away, which kinda  
>surprised me. But I just thought I'd been lucky.

I have no idea.  The problem is that there are so very many ways in which it
MIGHT fail, depending on exactly what you're passing, and I don't know the
ABI.

I would consider it almost certainly foolhardy, but it's up to you.

>And we want new & old plugins to work on the host app now, while the  
>future host app will only accept new ones. It sounds like this will  
>work after all? Don't worry about portability, because even if a port  
>was planned, it'd require the new callback style *with* the context  
>pointer right away.

In that case, my suggestion is this:  Test it.  You don't even care about
the general case of extra parameters; you care about the SPECIFIC case of
this particular extra parameter, and of course, you can check for that.

I would suggest, if you wanna be very careful:  Embed some assembly around
the call to check all the registers before and after to see what happens,
just in case of madness.

-s
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Passing too many parameters to a function? (From: Uli Kusterer <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.