On Fri, Mar 09, 2007 at 09:16:24PM -0700, Topher Fischer wrote:
> I happened to be browsing through the ivtv driver tonight, and I came
> across a C operator that I had never seen before, the ellipses (...). 
> Here's an example of it in use:
> 
>     switch (val) {
>         case 0 ... 10 :
>             printf("Somewhere between 0 and 10.\n");
>             break;
>         case 11 ... 20:
>             printf("Somewhere between 11 and 20.\n");
>             break;
>         default:
>             printf("Big.\n");
>     }
> 
> I did a quick google, but didn't find anything about it.  Does anybody
> know what the deal is with this?  Is this only usable with certain
> versions of gcc?  Does it apply in other ways besides case statements?

It's a gcc extension, searching google for 'gcc "case ranges"' will get
you the full documentation.  All the documentation really says is that
it works with char values also.

--
Byron Clark

Attachment: signature.asc
Description: Digital signature

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to