Re: gcc-3.4.4-20050211: maybe a danger behaviour

2005-03-10 Thread James E Wilson
Denis Zaitsev wrote: a) Formally, the code is correct. As p->what can never be < 0 according to its type. I am assuming this is C code. C and C++ have different rules for enums. This isn't strictly true. The C standard does not say that enums are unsigned. It only says that they are equivalent

gcc-3.4.4-20050211: maybe a danger behaviour

2005-02-26 Thread Denis Zaitsev
Consider the following example: enum w { //c=-1, a, b }; whattodo ( char option ) { static struct todo { enum w what; char option; } todos[]= { {a,'a'}, {b,'b'}, {-1} }; struct todo *p= todos; do if ( (option