C ellipses operator

Topher Fischer javert42 at cs.byu.edu
Fri Mar 9 21:16:24 MST 2007


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?

-- 
Topher Fischer
GnuPG Fingerprint: 3597 1B8D C7A5 C5AF 2E19  EFF5 2FC3 BE99 D123 6674
javert42 at cs.byu.edu


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://plug.org/pipermail/plug/attachments/20070309/ac0867b3/attachment.bin 


More information about the PLUG mailing list