Skip to content

Commit a6ea553

Browse files
committed
Try to expand a bit the comment on integer-pointer confusion with intptr_t.
1 parent 27a2fc4 commit a6ea553

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/limitations/compile-time-type-uncertainty.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,17 @@ with programmer impact:
9090
2. Instructions are therefore used that will preserve the tag on a
9191
capability dynamically by virtue of using arithetic instructions normally
9292
used only for pointer types.
93-
However, this means that CHERI C/C++ are not able to provide dynamic
94-
integer-pointer type-confusion prevention, as the types are inherently
95-
ambiguous.
93+
However, this means that CHERI C/C++ are not able to provide certain
94+
types of dynamic integer-pointer type-confusion prevention, as the types
95+
are inherently ambiguous.
96+
97+
For example, while with non-`intptr_t` integer types, the tag will always
98+
be cleared when its arithmetic operations are applied to a pointer, this
99+
is not true when `intptr_t` is used for integers.
100+
If `intptr_t` is used extensively for integer types (e.g., as the atom
101+
type in a language runtime), then the opportunity for dynamic confusion
102+
is restored: arithmetic operations intended only to operate on integer
103+
values will also operate on pointers preserving the tag.
96104

97105
It is worth further noting that the C types `long` and `unsigned long` have
98106
historically been used for these purposes, although that has been discouraged

0 commit comments

Comments
 (0)