This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Switch statement case range


Thank you!

I'd like to find out some day exactly how much I _don't_ know. :-)

Best regards,
Rick C. Hodgin

--- On Sun, 4/8/12, Marek Polacek <polacek@redhat.com> wrote:

> From: Marek Polacek <polacek@redhat.com>
> Subject: Re: Switch statement case range
> To: "Rick Hodgin" <foxmuldrster@yahoo.com>
> Cc: "gcc" <gcc@gcc.gnu.org>
> Date: Sunday, April 8, 2012, 12:05 PM
> On Sun, Apr 08, 2012 at 08:59:46AM
> -0700, Rick Hodgin wrote:
> > What are the possibilities of adding a GCC extension to
> allow:
> > 
> > switch (foo) {
> > case 1:
> > case 2:
> > case 3 to 8:
> > case 9:
> > default:
> > }
> 
> This already exists (and is a GNU extension):
> 
> ? switch (foo)
> ? ? {
> ? ? case 1:
> ? ? ? break;
> ? ? case 3 ... 8:
> ? ? ? break;
> ? ? default:
> ? ? ? break;
> ? ? }
> 
> ??? Marek
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]