beowulfe
February 16th, 2005, 03:22 PM
A while back, a buddy of mine happened to show me an interesting code segment that I didn't even know was valid C code. It was something like the following format:
switch(aByte)
{
while(someCondition)
{
case 0:
doSomething;
case 1:
doSomething;
case 2:
doSomething;
case 3:
doSomething;
case 4:
doSomething;
case 5:
doSomething;
case 6:
doSomething;
case 7:
doSomething;
}
}
According to a web site I found back then, the developer who came up with such a screwy code structure worked for some graphics company, and the purpose of the particular segment was a very efficient way to copy graphics data from one place to another. It also stated that there was a question among the ANSI committee whether it SHOULD be legal C (apperently, the compiler the writer used did compile this code), and was finally determined that it is "valid" code.
I, unfortunately, can't find anything about this in any of my web searches. I do remember that the code was called "<Something's> Machine" (I think named after the original author.......).
Does anyone have any idea what this was actually called, and where I can get information on it?
switch(aByte)
{
while(someCondition)
{
case 0:
doSomething;
case 1:
doSomething;
case 2:
doSomething;
case 3:
doSomething;
case 4:
doSomething;
case 5:
doSomething;
case 6:
doSomething;
case 7:
doSomething;
}
}
According to a web site I found back then, the developer who came up with such a screwy code structure worked for some graphics company, and the purpose of the particular segment was a very efficient way to copy graphics data from one place to another. It also stated that there was a question among the ANSI committee whether it SHOULD be legal C (apperently, the compiler the writer used did compile this code), and was finally determined that it is "valid" code.
I, unfortunately, can't find anything about this in any of my web searches. I do remember that the code was called "<Something's> Machine" (I think named after the original author.......).
Does anyone have any idea what this was actually called, and where I can get information on it?