Re: Are method declarations just comments?
Re: Are method declarations just comments?
- Subject: Re: Are method declarations just comments?
- From: Chris Gehlker <email@hidden>
- Date: Mon, 09 Jul 2001 13:09:54 -0700
On 7/9/01 11:07 AM, "Peter Ammon" <email@hidden> wrote:
>
on 7/8/01 2:27 AM, Andreas Monitzer at email@hidden wrote:
>
>
> On Sunday, July 8, 2001, at 08:52 , Chris Gehlker wrote:
>
>
>
> Header files are in ObjC (like in C, unlike in C++) just a hint for the
>
> compiler and for the user. You can send every message you like to every
>
> object, but if it's not declared in the header, the compiler will spit out
>
> a warning.
>
>
Unless I'm mistaken, Objective-C is actually more lax about requiring
>
function declarations. For example, C requires that variadic functions
>
(that is, functions with a variable number of arguments like printf) be
>
prototyped, whereas AFAIK Objective-C places no such requirements on
>
variadic methods (e.g. arrayWithObjects:)
It seems that if you only invoke a method from the file where you defined
it, the compiler won't notice if you forgot to declare it. Once you invoke
it from a second file, the compiler notices that it wasn't declared and
issues warning every place you mention it.
--
Every society honors its live conformists and its dead troublemakers.
-Mignon McLaughlin, author