Lesser known C stuff
I happened to be browsing through the ivtv driver source last night, trying to find out how closed captioning gets recorded. Anyway, I came across an operator that I had never seen before. The ellipses! It was something like this:
switch (val)
{
case 0 ... 10 :
printf("Between 0 and 10.n");
break;
case 11 ... 50 :
printf("Somewhere from 11 to 50.n");
break;
case 51 ... 99999 :
printf("Really big.n");
break;
}
Isn’t that just crazy? Apparently, it’s an extension that gcc supports. I found a nice Red Hat manual that has some great stuff on gcc. I never would have found it without the assistance of Lord Byron. I had to ask the PLUG mailing list about it because I couldn’t find anything about it with Google, because I was searching for “C ellipses operator.” Lord Byron told me that it was known as a “case range.” It’s amazing what using correct search terms can do for you.
Anyway, I recall reading somewhere that you should never blog while drunk. This isn’t a problem for me since I don’t drink, but I’ve been told that lack of sleep can have a similar effects on a person, so I’m going to put my laptop down and go to sleep now.
[Disclaimer] This post took me about 2 weeks to write. I started it two weeks ago, then realized that my version of Wordpress was _horrible_ at formatting code. It was ignoring my <pre> tags! I decided to upgrade Wordpress before I drove myself insane trying to fight against Wordpress, but then I got distracted, and never got around to doing the upgrade until now.
June 18th, 2007 at 5:38 pm
you make me laugh out load!
i’m glad you went to bed, ….and that you don’t drink!