C ellipses operator
Byron Clark
byron at theclarkfamily.name
Fri Mar 9 21:40:43 MST 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://plug.org/pipermail/plug/attachments/20070309/7163dd3c/attachment.bin
More information about the PLUG
mailing list