Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Google   


Typical Errors in C

Lint is a great tool. repeat after me lint is a great tool and if somebody is not using it he/she is does not respect himself and his time... It's simply stupid to spent time debugging errors that lint can find.

  1. Non-terminated comment, "accidentally" terminated by some subsequent comment, with the code in between swallowed.
            a=b; /* this is a bug
            c=d; /* c=d will never happen */
  2. Accidental assignment/Accidental Booleans
            if(a=b) c;      /* a always equals b */

    Depending on your viewpont, the bug in the language is that the assignment operator is too easy to confuse with the equality operator; or maybe the bug is that C doesn't much care what constitutes a boolean expression: (a=b) is not a boolean expression! (but C doesn't care)


Lint, Debugging

See also Softpanorama Debugging Links

Typical errors


Copyright © 1996-2008 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Standard disclaimer: The statements, views and opinions presented on this web page are those of the author and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: February 28, 2008