This one comes courtesy of a co-worker who once upon a time was the lead developer for the Manx (http://www.itee.uq.edu.au/~csmweb/decompilation/hist-c-pc.html) compiler.
He ran into the following problem that was reported by the customer. They tried and tried to get the following code to compile and it didn’t seem to work:
float ReadFileAndCalculateAverage(FILE *InputFile, int Values, int LengthOfValues, int *NumberOfValuesRead)
// Read the Values array from InputFile.
<Code eliminated for brevity>
// Now calculate the average.
for (i = 1 ; i <= *NumberOfValuesRead ; i += 1)
average += Values[i];
average = average/*NumberOfValuesRead;
int main(int argc, char *argv)
inputFile = fopen(“MyFile.Txt”);
if (inputFile != NULL)
average = ReadFileAndCalculateAverage(inputFile, Values, sizeof(j) / sizeof(j), &numberOfValues);
Now imagine this problem in a 10,000 line source file 🙂 Have fun trying to track it down.
Edit: Removed bogus <p>’s. Thank you Newsgator’s .Text plugin…