Re: SEEK_* enum values in SeekType



On 19 Mar 2002, Michael Meeks wrote:

> 	The C++ IDL binding spec specifies that every enumeration value is in
> the global namespace ? surely that's just total folly ?
> 
> > I know this is awfully late for this, but can we do something about it?
> 
> 	Can they not be namespaced in C++ ?

yes but -- defines are not namespaced, so both the definitioan and the
usage of the enum is going to break, since the following two scraps of
code:

// 1
namespace Bonobo {
	class Stream {
		enum SeekType {
			SEEK_CUR,
			SEEK_POS,
			SEEK_END
		}
	}
}

// 2
void DoSomethingInCpp (Bonobo::Stream_ptr stream)
{
	// Rewind stream
	storage->seek (Bonobo::Stream::SEEK_POS, 0);
}

will first be translated by the preprocessor to:

// 1
namespace Bonobo {
	class Stream {
		enum SeekType {
			0,
			1,
			2
		}
	}
}	

// 2
void DoSomethingInCpp (Bonobo::Stream_ptr stream)
{
        // Rewind stream
        storage->seek (Bonobo::Stream::0, 0);
} 

Which is never going to work.

-- 
   .--= ULLA! =---------------------.   `We are not here to give users what
   \     http://cactus.rulez.org     \   they want'  -- RMS, at GUADEC 2001
    `---= cactus cactus rulez org =---'
God is Real, unless declared Integer.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]