1. 15
  1.  

  2. 4

    Yeah, get amongst it.
    Since this article was written there is now static code analysis in VS 2013. LLVM also has great static code analysis in Analyse builds and it even does some reasonable checking on normal builds.
    I would also recommend building in at least two compilers where possible, say, VS and LLVM. Even if you don’t do any actual releases with the other compiler, just getting the compile to work and/or getting rid of warnings can really straighten your code up. LLVM and gcc have great printf format checking. VS has great “This function didn’t use one of it’s parameters” checking.

    1. 2

      Minor trick for dealing with VS:

      #define URFP(x) ((void)x)
      

      Especially when dealing with interfaces that pass in things you don’t need (say, when implementing a fake stub or something), that can shut the compiler up about a lot of things.

      EDIT: And yeah, compiling with multiple compilers instantly adds a great deal of quality and robustness to your project. Especially if you can do so across multiple operating systems!

      1. 1

        Compiling with multiple compilers instantly adds a great deal of quality and robustness to your project. Especially if you can do so across multiple operating systems!

        Back slashes in paths! We still have an application at my work that writes user settings to Program Files :( “Oh, you don’t have write permission to everything on the drive?”. It is better with modern versions of Windows, but it still seems to be more relaxed, see also opening ports below 1024, file system case insensitivity. Character restrictions in filenames, requiring “C:\” style paths.

    2. 2

      PVS works like a charm to me. And yes, that trial period is a must try.

      1. 2

        I think this can also be taken as a good argument for strongly typed languages and sum-types that enable totality checking.