Not Naming Any Names

Published 2011-04-08 on Farid Zakaria's Blog

He was told to write atoi

A good friend of mine from the University of Waterloo just send me a code snippet he had saved up. This is a very remarkable piece of code. The background to the code was that it was written during the operating systems course (Computer Engineering) and that one of his group members was asked to write an aoti function in C for the OS. Here's what he e-mailed back:


INT16 atoi_convert (CHAR * input)
{
    UINT16 output = 0 ;
    CHAR * a;
    while (a == "input++")
    {
      output = output*10 + (a -'0');
     return output ;
    }
    return output;
}

It's impressive that it compiles.

Honestly, words can't describe the code above. I wish I could say that it is fake however the person who wrote this is now graduating with a degree in Computer Engineering from UW. Shows how far you can get by in life knowing nothing I guess.