Aussie AI

Building More Bugs

  • Book Excerpt from "Generative AI in C++"
  • by David Spuler, Ph.D.

Building More Bugs

Advanced build engineering is a non-obvious way to improve code quality. The basic idea is to build lots of test versions of your program to shake out more of the insidious bugs. The strategy is:

  • Build multiple executable versions.
  • Run them against the full test suite (e.g. unit testing, regression testing, mutation testing, etc.).
  • Make sure someone's watching to see if anything fails.

The vast majority of your C++ code should be standardized and platform-independent, so a simple way to test it fully is to thrash it across multiple platforms and compilers. You can watch for both compile-time warnings and runtime failures. Here are some suggestions:

  • Multiple OS platforms (Linux, Windows, Mac)
  • Multiple C++ compilers
  • Multiple optimization levels
  • Multiple CPU architectures
  • 32-bit and 64-bit OS versions
  • With self-testing or debug code enabled and disabled.

This method will give a huge cascade if you're got a simple bug. But the more important idea of this whole strategy is to watch for the singular failures, where one platform has tickled an obscure code weakness, such as race conditions in multi-threading code.

 

Next:

Up: Table of Contents

Buy: Generative AI in C++: Coding Transformers and LLMs

Generative AI in C++ The new AI programming book by Aussie AI co-founders:
  • AI coding in C++
  • Transformer engine speedups
  • LLM models
  • Phone and desktop AI
  • Code examples
  • Research citations

Get your copy from Amazon: Generative AI in C++