Re: linking error
Re: linking error
- Subject: Re: linking error
- From: Greg Guerin <email@hidden>
- Date: Sun, 3 Aug 2008 16:06:55 -0700
Jeffrey Oleander wrote:
I've been programming in C for about 22 years.
That was about the same time I gave up trying
to memorize fine points of every programming
language's standard. To me, a "static" has
nothing to do with what file it was declared in
but in what program block it was declared, and
that's why the "extern" is necessary to refer
to it from elsewhere. So, what are we missing?
The keyword 'static' is used in C both for limiting scope, e.g. of
functions or variables, and for specifying the storage class of
variables. I think this was explained in the original K&R book.
Any variable declared outside a function defaults to the static
storage class. Any variable declared inside a function defaults to
the auto storage class.
http://www.space.unibe.ch/comp_doc/c_manual/C/CONCEPT/storage_class.html
You also have to use consistent types. So removing the 'static' from
'static char' is only half the problem. The other half of the
problem is that a global variable is defined as 'char' in one place,
but declared 'extern int' elsewhere.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden