Source: https://www.doc.ic.ac.uk/~phjk/Publications/BoundsCheckingForC.pdf