Agreed.
But when I was in school, casting everything extern makes everything public
in scope. not only was I taught that was bad programming practice, but it
means you can't reuse or overload function names.
I thought maybe there was a programmatic reason for casting everything
extern. I guess it's just the convention of the programmer who wrote the
starter app.
Cheers, Ted
> -----Original Message-----
> From: Aaron Ardiri [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, October 26, 1999 11:22 AM
> To: [EMAIL PROTECTED]
> Subject: Re: extern globals and procedures
>
> > I notice in most of the sample code, every global variable and
> > function/procedure is declared extern. I'm not used to coding like
> this,
> > and thus far I have NOT been declaring my code segments extern. Is this
> ok,
> > or will it break in future OSs? What is extern really doing in the
> sample
> > code? It seems unnecessary for a single segment program.
>
> the "extern" keyword is primarially being used to tell the
> compiler that a function or variable is defined somewhere
> else in the source code (ie, another file that may not be
> included in the current file context).
>
> most of the time, if you forget to declare it extern, the
> compiler will complain and say "what is this?" - mainly because
> you have not defined it anywhere.
>
> if all your code is in one file, you wont need the
> "extern" declarations.. but doing so (one large file) is
> normally considered "bad practice" (hope i dont step on
> some toes here).. seperate files enforce some form of
> modularity.
>
> cheers.
>
> az.
> --
> Aaron Ardiri
> Lecturer http://www.hig.se/~ardiri/
> University-College i G�vle mailto:[EMAIL PROTECTED]
> SE 801 76 G�vle SWEDEN
> Tel: +46 26 64 87 38 Fax: +46 26 64 87 88
> Mob: +46 70 656 1143 A/H: +46 26 10 16 11
>
>