Menu

#61 switch-case with default wich has no break; at the end

closed
None
5
2004-03-20
2004-02-08
Anonymous
No

Hi!
Im useing SDCC Feb 3 2004 (MINGW) with the
parameters:
sdcc.exe main.c -mmcs51 --use-stdout --no-xinit-opt -
I. -c

It will fail to compile the code:

void f(int a)
{
switch (a)
{
default:

}
}

The message:
main.c:7: parse error: token -> '}' ; column 9

But if you place a "break;" under the default it will work
fine.

Anyway its ok just ....

Best regards and many thanks for this compiler guys!
beba
beba(no spam)koli.kando.hu

Discussion

  • Erik Petrich

    Erik Petrich - 2004-02-09
    • labels: 101552 -->
     
  • Erik Petrich

    Erik Petrich - 2004-02-09

    Logged In: YES
    user_id=635249

    This is not a bug. According to the syntax given in the ANSI
    C standard, all labels, including "default:" are to be
    followed a statement. However, it is not usual for compilers
    to support what you are wanting as an extension to the
    language, so I have reclassified this from a bug report to a
    feature request.

     
  • Erik Petrich

    Erik Petrich - 2004-03-20

    Logged In: YES
    user_id=635249

    Implemented in src/SDCC.y 1.93

     
  • Erik Petrich

    Erik Petrich - 2004-03-20
    • assigned_to: nobody --> epetrich
    • status: open --> closed
     

Log in to post a comment.