Skip to content

Commit

Permalink
Fix doc typos in new safety page
Browse files Browse the repository at this point in the history
  • Loading branch information
hsutter committed Oct 10, 2024
1 parent 27607e5 commit 3fe8d6f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/cpp2/safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cppfront myfile.cpp2 -no-div-zero-checks # division by zero not checked

### <a id="null-dereference"></a> Null dereference (run-time checked)

Dereferencing a null pointer is undefined behavior, and is rejected at run time by checking the pointer is nonzero.
Dereferencing a null pointer is undefined behavior, and is rejected at run time by checking the pointer is not null.

To disable this check at a specific place in your code, use `unchecked_dereference`. For example:

Expand All @@ -92,7 +92,7 @@ cppfront myfile.cpp2 -no-null-checks # null dereferences not checked

### <a id="subscript-bounds"></a> Subscript bounds (run-time checked)

Accessing an out of bounds subscript is undefined behavior, and is rejected at run time by checking the subscript is nonzero. For an expression `a[b]` where
Accessing an out of bounds subscript is undefined behavior, and is rejected at run time by checking the subscript is in bounds. For an expression `a[b]` where

- `a` is contiguous and supports `std::size(a)`, and
- `b` is an integral value
Expand Down

0 comments on commit 3fe8d6f

Please sign in to comment.