Mail Archives: djgpp/1997/02/12/06:29:33
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 -