Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Files

Latest commit

caff1bb · Jun 30, 2020

History

History

samples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 13, 2018
Sep 9, 2018
Apr 26, 2018
Apr 26, 2018
Apr 26, 2018
Oct 22, 2019
Apr 26, 2018
Apr 26, 2018
Jun 30, 2020

Sample Checked C code

This directory contains some sample Checked C code:

  • hello-world.c: The canonical "hello, world" program, using Checked C. Show how to declare bounds for the array of arguments.
  • echo-args.c: Echo arguments to the output console. Use the array of arguments with bounds.
  • echo-args-buggy.c: A buggy version of echo-args.c with an off-by-one error that tries to read past the end of the array of arguments.
  • find-pattern.c: The "find pattern" program from Kernighan and Richie, rewritten to use Checked C. This program illustrates some subtle points about using strings in Checked C.
  • string-helper.c: A short tutorial on using strings in Checked C, with Checked C versions of atoi, squeeze, strcmp, strlen, and reverse.
  • avoid-warning.c: This example shows how to use dynamic_bounds_cast to avoid a compile-time warning that the compiler cannot prove declared bounds are valid.
  • spec: Examples drawn from the Checked C specification.