Re: Crash when calling va_arg()
Re: Crash when calling va_arg()
- Subject: Re: Crash when calling va_arg()
- From: Jens Alfke <email@hidden>
- Date: Wed, 04 Jul 2012 16:43:08 -0700
On Jul 4, 2012, at 4:30 PM, Tito Ciuro wrote:
> This allows it to work without crashing, but I'd like if possible to avoid having to place the sentinel. Any ideas?
There's no way around this, other than perhaps passing in the number of variable arguments as an explicit parameter. The C calling conventions don't allow a function to detect how many arguments it has, or where the argument list ends in the stack. So va_arg() can't magically return NULL at the end of the argument list, as your code expects it to.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden