const char * utoroman(unsigned int i){
static char s[16];
if(i>=4000)return "Magnus";
if(i==0)return "Nihil";
char *t=s+15;//writing the numbers in backwards, old trick.
int m=0;
do{
switch(i%10){
case 1 ... 3://this is a gnu extension
case 6 ... 8:
*--t="IXCM"[m];
i--;
continue; //ok, this is weird
case 5: *--t="VLD"[m];
break;
case 4: *--t="VLD"[m];
if(0) //is this even LEGAL?!
case 9: *--t="XCM"[m]; //on 4 it skips this line, on 9 it doesn't.
*--t="IXCM"[m];
case 0: break;
}
m++;
i/=10;
}while(i>0);
return t;
}
So, is the weird if on line 18 legal?
Edited by rocketboy9000, 30 March 2011 - 07:12 PM.
figured out how to get rid of the goto that was in it


Sign In
Create Account


Back to top









