FROM : Ole Voss
DATE : Sun Oct 31 16:18:17 2004
> On Oct 31, 2004, at 12:43 AM, Ole Voss wrote:
>> Why do I have to include the header file of this singleton class in
>> every
>> other class I use it in? Should the class not be available to the
>> compiler
>> the moment it's included in the 'main.m'?
>
> There is nothing special about a file named "main.m" in the compiler's
> eyes, so no, the class should not be available everywhere just because
> its header is included in a file named "main.m".
>
>> I'm missing something fundamental here - it's always like that :-)
>
> Independent compilation. Essentially, the compiler is called once per
> implementation (.m, .c, .cpp, etc.) file and must be provided with a
> file that is both syntactically correct *and complete* in order to
> generate an object file. This is generally done by using the C
> preprocessor, via the #include or (in Objective-C) #import directive to
> bring in the text of another file.
>
> Java is different, it actually has the compiler do all of the necessary
> package/class dependency tracking and examine other implementation and
> class and jar files, compiling additional implementation files into
> class files as necessary.
>
> -- Chris
>
>
This also means, that I have to include the header file wherever I need it?
That could mean that the same class has to be recompiled tens of times -
right?
So what possibilities do I have to create global variables?
Regards
Ole.
------ End of Forwarded Message
DATE : Sun Oct 31 16:18:17 2004
> On Oct 31, 2004, at 12:43 AM, Ole Voss wrote:
>> Why do I have to include the header file of this singleton class in
>> every
>> other class I use it in? Should the class not be available to the
>> compiler
>> the moment it's included in the 'main.m'?
>
> There is nothing special about a file named "main.m" in the compiler's
> eyes, so no, the class should not be available everywhere just because
> its header is included in a file named "main.m".
>
>> I'm missing something fundamental here - it's always like that :-)
>
> Independent compilation. Essentially, the compiler is called once per
> implementation (.m, .c, .cpp, etc.) file and must be provided with a
> file that is both syntactically correct *and complete* in order to
> generate an object file. This is generally done by using the C
> preprocessor, via the #include or (in Objective-C) #import directive to
> bring in the text of another file.
>
> Java is different, it actually has the compiler do all of the necessary
> package/class dependency tracking and examine other implementation and
> class and jar files, compiling additional implementation files into
> class files as necessary.
>
> -- Chris
>
>
This also means, that I have to include the header file wherever I need it?
That could mean that the same class has to be recompiled tens of times -
right?
So what possibilities do I have to create global variables?
Regards
Ole.
------ End of Forwarded Message
| Related mails | Author | Date |
|---|---|---|
| Ole Voss | Oct 31, 16:18 | |
| Finlay Dobbie | Oct 31, 16:40 | |
| Ole Voß | Oct 31, 23:10 | |
| Finlay Dobbie | Oct 31, 23:47 | |
| Ole Voß | Nov 1, 09:07 | |
| Kevin Ballard | Nov 1, 09:37 | |
| Ole Voß | Nov 1, 13:09 | |
| Kevin Ballard | Nov 1, 13:11 | |
| M. Uli Kusterer | Nov 5, 00:15 |






Cocoa mail archive

