[omniORB] nested modules and string constants in MSVC++

Daniel Bell Daniel.Bell@colorbus.com.au
Fri, 16 Mar 2001 10:55:53 +1100


Hi,

I believe I've just come across a bug with nested modules and string
constants in MSVC++. Consider the following bit of IDL:

module outer
{
	module inner
	{
		const string STRING_CONST = "the value";
	};
};

In the .cpp file produced, the C++ for the initialisation fo the string
constant is: 

#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER)
// MSVC++ does not give the constant external linkage othewise.
namespace outer::inner {
  extern const char * STRING_CONST="the value";
}
#else
const char * outer::inner::STRING_CONST = "the value";
#endif

MSVC++ doesn't like the "namespace outer::inner". However, if this is
changed to nested namespace calls (ie. namespace outer { namespace inner {
... } }), then this works fine.

Is this a bug or am I missing something? 

Daniel

- Daniel Bell
- Software Engineer, Colorbus Pty Ltd
- Email: daniel.bell@colorbus.com.au
- Phone: 61 3 8574 8035
- WWW:   http://www.colorbus.com