RE: [Dev-C++] 'extern const' and std::vector
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@at...> - 2003-05-01 15:05:30
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Per Westermark > Sent: Thursday, May 01, 2003 5:23 PM > To: David McKen > Cc: dev...@li... > Subject: Re: [Dev-C++] 'extern const' and std::vector > > > I'm not too good at the latest updates of the standards, but > to the best > of my knowledge, there is no const extern declarations. Why? > Extern is just a keyword to inform the compiler that > somewhere in another > linking unit, the specified variable or function exists. > However, you can > not just lie, because when you reference the symbol, the compiler will > insert a name-mangled reference and the linker will then fail if an > exactly identical reference isn't available somewhere in one of the > included object or library files. If you do extern int x; and you do not define x elsewhere, it is considered a definition. The same applies for extern int x=1; It is considered a definition (extern is ignored). Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |