linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Glynn Clements <glynn.clements@virgin.net>
To: Alina Valea <avalea@home.ro>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: static variables and functions in header files
Date: Tue, 27 Aug 2002 15:17:07 +0100	[thread overview]
Message-ID: <15723.35299.232003.638370@cerise.nosuchdomain.co.uk> (raw)
In-Reply-To: <20020827071753.14590.qmail@relay1.home.ro>


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>

      parent reply	other threads:[~2002-08-27 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15723.35299.232003.638370@cerise.nosuchdomain.co.uk \
    --to=glynn.clements@virgin.net \
    --cc=avalea@home.ro \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).