* static variables and functions in header files
@ 2002-08-27 7:17 Alina Valea
2002-08-27 7:19 ` Carlos Fernández
2002-08-27 14:17 ` Glynn Clements
0 siblings, 2 replies; 3+ messages in thread
From: Alina Valea @ 2002-08-27 7:17 UTC (permalink / raw)
To: linux-c-programming
Hello,
Has anybody ever declared variables and functions as static
in header files (that will be included in several .c files)?
I've just seen this in a project and it puzzled me. Is it OK
to do it?
Thanks, Alina
----
Home, no matter how far...
http://www.home.ro
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: static variables and functions in header files
2002-08-27 7:17 static variables and functions in header files Alina Valea
@ 2002-08-27 7:19 ` Carlos Fernández
2002-08-27 14:17 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Fernández @ 2002-08-27 7:19 UTC (permalink / raw)
To: Alina Valea, linux-c-programming
Yes but you need to be aware of its meaning :-)
Do it with care. Be gentle with the code...
----- Original Message -----
From: "Alina Valea" <avalea@home.ro>
To: <linux-c-programming@vger.kernel.org>
Sent: Tuesday, August 27, 2002 2:17 PM
Subject: static variables and functions in header files
>
>
> Hello,
>
> Has anybody ever declared variables and functions as static
> in header files (that will be included in several .c files)?
> I've just seen this in a project and it puzzled me. Is it OK
> to do it?
>
> Thanks, Alina
>
>
> ----
>
> Home, no matter how far...
> http://www.home.ro
> -
> To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: static variables and functions in header files
2002-08-27 7:17 static variables and functions in header files Alina Valea
2002-08-27 7:19 ` Carlos Fernández
@ 2002-08-27 14:17 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2002-08-27 14:17 UTC (permalink / raw)
To: Alina Valea; +Cc: linux-c-programming
Alina Valea wrote:
> Has anybody ever declared variables and functions as static
> in header files (that will be included in several .c files)?
> I've just seen this in a project and it puzzled me. Is it OK
> to do it?
It won't usually cause any problems, but it's seldom a good idea.
What's the point in declaring identically-named (but distinct)
variables in each source file which includes a particular header?
In general, header files should only contain declarations; definitions
belong in the actual source (.c) files.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-08-27 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-27 7:17 static variables and functions in header files Alina Valea
2002-08-27 7:19 ` Carlos Fernández
2002-08-27 14:17 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).