• 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: Parameter lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parameter lists


  • Subject: Re: Parameter lists
  • From: Alastair Houghton <email@hidden>
  • Date: Sat, 8 Nov 2003 09:26:05 +0000

On 8 Nov 2003, at 02:09, John Randolph wrote:

On Nov 6, 2003, at 10:18 PM, John MacMullin wrote:

I have a method in which I am trying to pass multiple parameters as
follows:

- (void)clearScreenFields:(int)sortCheck, (BOOL)redCheck
{
}

I am sending the following:

[self clearScreenFields:clearAndNoSort, redDisplay];}

This is patterned after the Objective-C pocket reference at pages 18-20.

Let's see... According to the grammar:

method-selector:
unary-selector
keyword-selector [ , ... ]
keyword-selector [ , parameter-type-list ]

So, it would appear that John is seeing a compiler bug.

No, because although the grammar doesn't say so, AFAIK parameter-type-list is only supported for varargs functions... The Objective-C Programming Language implies this here:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 5objc_language_summary/chapter_6_section_9.html

where it says that "arguments are declared after colons" and makes no mention of commas, and here:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 3objc_language_overview/chapter_3_section_3.html

where it explicitly states that varargs functions use the comma syntax, as well as showing that ordinary methods use ':'.

Also, the commas are *not* part of the method name, whereas colons are... so allowing commas outside of the varargs case would result in a different method name and would break the link between method name and number of arguments. (Obviously, that link is already broken in the varargs case.)

Kind regards,

Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Parameter lists (From: John MacMullin <email@hidden>)
 >Re: Parameter lists (From: John Randolph <email@hidden>)

  • Prev by Date: Re: (no subject)
  • Next by Date: Re: NSXMLParser and dtds
  • Previous by thread: Re: Parameter lists
  • Next by thread: Fwd: Parameter lists
  • Index(es):
    • Date
    • Thread