|
|
>> 2. A header file is what defines what can be accessed from outside a
>> given source file. Without a header file, how do you determine what's
>> supposed to be public and what isn't?
>
> No. You're thinking that header files are part of the language or
> something. It's just a convention. If you're accessing something
> outside of the file you're compiling, you declare it "extern". It's
> convenient to put the "externs" in a separate files, but it isn't
> necessary.
I see...
I know a header file can theoretically contain anything. But I always
thought that the idea was to put only public things in a header file,
because if it's not in the header file, other files can't know it exists
so it can't be accessed.
>> (C is a lot simpler, it's just astonishingly easy to shoot yourself in
>> the foot with it.)
>
> Yes. Maybe you should try something intermediary first, like C# or Java
> or Pascal or some such.
Java and Pascal I already have quite extensive experience with.
(Although I imagine since the last time I touched Java the APIs have
been changed *again*. Oh, and I hear they kludged in generics?) Both of
these languages know the difference between a pointer and an array, however.
Post a reply to this message
|
|