> ok, I don't understand it
The whole point of the extern keyword is to extend a variable's lifespan beyond file scope. It allows global constants to exist across an entire project.

Vart's quote from the standard states that constants are linked internally in C++ by default, allowing you to initialize a constant in a header file. In the language's predecessor, C, constants weren't allowed to be initialized in header files, so extern was used. C++ supports the extern keyword because it was inherited from C. If someone can prove that a constant must or shall be linked internally, then I'll gladly shut up.

Do you know any good links that have examples of what you just said? For me, it's hard to learn without examples and just by someone's theoretical talk.

12-15-2006

whiteflags

> For me, it's hard to learn without examples
I already gave you an example on the previous page.

> and just by someone's theoretical talk.It's not theory. Vart doesn't think I'm following the ANSI Standard, but he's over-extending the rule he quoted: That is my only problem with what he's saying. I don't really care either way whether you use extern or not, it doesn't matter.

12-15-2006

vart

Quote:

Originally Posted by citizen

Vart doesn't think I'm following the ANSI Standard,

Never said that... just tried with VC++2005Express and it wasn't working...