Re: How to implement float min(float x, ...) ?
Re: How to implement float min(float x, ...) ?
- Subject: Re: How to implement float min(float x, ...) ?
- From: Andrew Farmer <email@hidden>
- Date: Sun, 16 Nov 2008 23:48:15 -0800
On 16 Nov 08, at 23:38, Oleg Krupnov wrote:
I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.
I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:
float min(float x, ...);
Can anyone suggest the implementation?
It's not possible. There's no way to determine the length of an
argument list - you need either a delimiter, or an extra argument to
signal the number of arguments.
See 'man stdarg' for what you've got, and what it can do.
_______________________________________________
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