Menu

#84 switch statement bug with short integer

closed-fixed
nobody
Parsing (77)
5
2003-06-10
2002-10-24
Anonymous
No

The switch/case statement does not seem to work
correctly with short integers. I founs a workaround by
casting into (int) but it can be annoying with no
workaround...

Example

switch(request.field)
{
case 22:
default:
}

where request.field is a "short" never reaches the case
"22" even if the short is 22, it goes to default case.

Discussion

  • Pat Niemeyer

    Pat Niemeyer - 2003-06-10
    • status: open --> closed-fixed
     
  • Pat Niemeyer

    Pat Niemeyer - 2003-06-10

    Logged In: YES
    user_id=18885

    Fixed in 1.3. The switch value was not being compared
    properly. Now any numeric or wrapper type can be used.

     

Log in to post a comment.

MongoDB Logo MongoDB