• 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: Amount of Arguments per Method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Amount of Arguments per Method


  • Subject: Re: Amount of Arguments per Method
  • From: Dave Keck <email@hidden>
  • Date: Sun, 21 Jun 2009 21:05:54 -1000

> clearly simplicity is important, but i'd like to know if there is a
> limit for the amount of arguments which a method can handle?

The C99 standard states that conforming compilers must support at
least 127 function arguments. I don't know if GCC enforces a limit
above this, but if it doesn't, then the maximum number of arguments is
only limited by the available stack space at run time. I assume
Objective-C would support the same functionality, but I'm sure someone
will correct me if I'm wrong. (Note that Obj-C uses two hidden
arguments when sending messages: self and _cmd. So in the case that
GCC supports the bare minimum of 127 function arguments, when sending
messages with Objective-C, you'd only be able to use 125. In practice
though, I think we all have a better chance of winning the lottery,
getting struck by lightning, and contracting swine flu all in the same
night, than creating a genuinely useful function that takes 128
arguments.)

> also, just for fun, what's the longest method name you've seen?

Probably my own; I'm relentless when it comes to clarity in method,
class and variables names. I've got a class name that's 55 characters,
a category (filename) that's 51, and a variable name that's (drumroll)
63 characters. Of course, it's arguable that after a certain length,
it's counterproductive. I think I'm just crazy...

David
_______________________________________________

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: 
 >Amount of Arguments per Method (From: Chunk 1978 <email@hidden>)

  • Prev by Date: Customize the NSMenu appearances
  • Next by Date: Re: Amount of Arguments per Method
  • Previous by thread: Amount of Arguments per Method
  • Next by thread: Re: Amount of Arguments per Method
  • Index(es):
    • Date
    • Thread