www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/12/06:29:33

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help With Include Files.....PLEASE!
Date: Tue, 11 Feb 1997 19:40:04 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 31
Message-ID: <33013B94.18BB@cs.com>
References: <32ffba74 DOT 0 AT ntnews DOT compusmart DOT ab DOT ca> <5dptbh$lcl AT netserver DOT univ-lille1 DOT fr>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp107.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

triquet frederic wrote:
> 
> You shouldn't declare any variable in a "*.h" file: you'd better declare them
                ^^^^^^^                                            
> as 'extern' in this file and ( only once ) declare the vars in a '*.c'.
                                             ^^^^^^^
> 
> Why ?
> Because declaring a var in a '*.h' declares it several times ( each time the '*.h'
          ^^^^^^^^^
> is included )

Poor English notwithstanding, those highlighted words should be
"define", not "declare".  There is a BIG difference between declaring
something and defining it.  Here's a really general definition:

"declare" = announce that something exists
"define" = create that something

You can have as many declarations of a given object as you want, but one
and only one definition.

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019