complying with -Wall -pedantic -ansi

October 1st, 2004 at 8:39 pm

Ah… the triple that are the enemy of every hacker trying to make his program “ISO/ANSI C++ clean”.

My worst enemies were signed/unsigned comparisons (due to some old code iterating with “int” over arrays, which later turned into vectors, and size_t is unsigned…) and classes with virtual functions lacking virtual destructors. Now, this was annoying, since those classes need no destructors at all.

In any case, my ~7 KLOC main ESMS engine now compiles with -Wall -pedantic -ansi (with g++ v2.96 and v3.2.2) – Yeehay !

It also made me look at some (very) old C code of mine, where I got tired of declaring i and j for iteration in every function, so I make them global. *shudder*

Related posts:

  1. lotsa code
  2. a cool algorithm for counting ones in a bitstring

Comments are closed.