• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to implement float min(float x, ...) ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to implement float min(float x, ...) ? (From: "Oleg Krupnov" <email@hidden>)

  • Prev by Date: How to implement float min(float x, ...) ?
  • Next by Date: Re: How to implement float min(float x, ...) ?
  • Previous by thread: How to implement float min(float x, ...) ?
  • Next by thread: Re: How to implement float min(float x, ...) ?
  • Index(es):
    • Date
    • Thread