• 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: MIN(), MAX()?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIN(), MAX()?


  • Subject: Re: MIN(), MAX()?
  • From: Graham Cox <email@hidden>
  • Date: Mon, 26 Oct 2009 20:52:28 +1100


On 26/10/2009, at 8:35 PM, Chunk 1978 wrote:

i can't find any info about these c functions in the documentation. each
take 2 floating point arguments, but i'm not positive what the function is
doing with the arguments:


float myMinimumFloat = MIN(50.0, 78.0);


what does the function do with 50 and 78?


also, my flaming shields are up. this is certainly very basic so flame away
if you must, but i just can't remember coming across these functions in any
of my c books.


They're not functions, they're macros. I don't think they're part of the C standard, but they are very useful and usually one of the first things that get added to a runtime.

MIN(a, b) returns the smaller value of a or b, and MAX( a, b ) returns the larger value.

Note: Apple's current implementations of MIN and MAX don't nest well if you have extra warnings enabled, because they use an internal local variable called _a, which is true of both macros, so one ends up shadowing the other. It's harmless, but slightly annoying.

--Graham


_______________________________________________

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: 
 >MIN(), MAX()? (From: Chunk 1978 <email@hidden>)

  • Prev by Date: Releasing NSCarbonWindow question.
  • Next by Date: Re: MIN(), MAX()?
  • Previous by thread: MIN(), MAX()?
  • Next by thread: Re: MIN(), MAX()?
  • Index(es):
    • Date
    • Thread