Re: case labels



Bartc wrote:
"CBFalconer" <cbfalconer@xxxxxxxxx> wrote in message

.... snip ...

if ((cmdcode < 1000) || (cmdcode > 2999)) misccmds();
else if (cmdcode < 2000) filecmds();
else if (cmdcode < 2500) editcmds();
else viewcmds();

which I consider readable and legitimate.

The code below is virtually identical to my fragment above and
compiles and runs with gcc.

.... snip ...

switch (cmdcode)
{case 1000 ... 1999: filecmds(cmdcode); break;
case 2000 ... 2499: editcmds(cmdcode); break;
case 2500 ... 2999: viewcmds(cmdcode); break;
default: misccmds(cmdcode);
};

It is still not acceptable to standard C. In addition, if you
examine the generated code, you may find that is has been converted
to my code in the first place, or that it is generating a 2000
entry transfer table (may depend on optimization), which is not
exactly optimum code. It doesn't hurt to have a rough idea of what
the compiler generates.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: reading more data than the record size (RECL)
    ... end snip ... My old compiles also write and read correctly with the subroutine I ... This overhead is there to allow Fortran ...
    (comp.lang.fortran)
  • Re: CW10 assignment, void*, func ptr warnings...
    ... > know why you're getting a warning. ... >> 3) errors about func signatures; ... The following compiles just fine for me: ...
    (comp.sys.mac.programmer.codewarrior)
  • Re: Possible Array problem. Applet Compiles but does not run!
    ... (snip main code) ... > This compiles, ... public class MobileShop extends Applet implements ActionListener{ ... HTH ...
    (comp.lang.java.help)
  • Re: Need some help with I/O
    ... > My textboox has less than a paragraph on the fgetsfunction ... > compiles and runs ok, it even builds a text file, but when I enter data ...
    (alt.comp.lang.learn.c-cpp)
  • RE: FC4 good new tech, bad legacy support
    ... > After installing FC4 I was impressed with all of the new features, ... Nothing compiles without errors. ... If the software doesnt work with either gcc 3.2 or gcc 4.x then its ... To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list ...
    (Fedora)