"2b|!2b==?" <root@your.box.comwrote in message
news:DKidnZAosIo_5bTbnZ2dnUVZ8qCqnZ2d@bt.com...
:I am getting strange compiler behaviour (compiler crashes) when
building
: some code. here is a snippet ..:
....
: struct Result
: {
: enum Enum
: {
: FirstItem = 0,
: Fred1 ,
: Fred2 ,
: LastItem
: };
: };
: typedef Result::Enum ResultType ;
....
: The line that causes the compielr to crash looks like this:
:
: int temp = somefunc();
: if ( temp <= A::ResultType::FirstItem || temp >=
: A::ResultType::LastItem )
....
: Is there something patently wrong about this.
In the current C++ standard specification, enum definitions
do not create a scope:
Result::Enum::FirstItem // does not exist in C++98
Result::FirstItem // here it is...
So the following would work:
if( temp<=Result::FirstItem || temp>=Result::LastItem )
Note that Result::Enum::FirstItem is expected to become
valid in the next revision of the C++ standard, and might
be implemented as an extension by some compilers today.
hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <
http://www.brainbench.com