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

Bounds declarations

David Tarditi edited this page May 7, 2018 · 10 revisions

Programmers declare bounds for variables with _Array_ptr, _Nt_array_ptr, or incomplete checked array types as part of the variable declarations. A bounds expression is placed after the declarator and before any initializer, if one is allowed. There are 3 kinds of bounds declarations:

  1. count(e): the number of array elements that a pointer points to.
  2. bytecount(e): the number of bytes that a pointer points to.
  3. bounds(lower, upper): the lower and upper bound for a ponter.
  4. bounds(unknown): the pointer has uknown bounds and cannot be used to access memory. Count and bytecount are syntactic sugar for bounds.