Nasty -O bug

bobef bobef at abv-nospam.bg
Wed Jan 16 05:32:55 PST 2008


Consider this code:

Stdout(cast(int)p.button_state,(cast(int)p.button_state)>0?-48:48).newline.flush;

p.button_state is uint and when compiled with -O (DMD 1.025, Windows), it outputs something like this:

1, -48
-1, -48

Removing the -O flags makes it work.
Also this thing (no matter of the -O flag):

auto a=FOCUS_LOST|SINKING;
if(p.cmd==a) {...}

works, but not this:

if(p.cmd==FOCUS_LOST|SINKING) {...}

both FOCUS_LOST and SINKING are defined like this (in different enums):

enum MYENUM
{
  FOCUS_LOST=4,
  ...
}

alias MYENUM.FOCUS_LOST FOCUS_LOST;

This is really annoying...

Thanks,
bobef


More information about the Digitalmars-d-bugs mailing list