Skip to content

Commit 05bebb7

Browse files
authored
Merge pull request diffblue#2595 from thk123/doc/use-can-cast
Add guidelines for using irepts in the code base
2 parents 9a75c65 + ba01589 commit 05bebb7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CODING_STANDARD.md

+6
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ Formatting is enforced using clang-format. For more information about this, see
197197
which safely manages the pointer. As such, `new` should only be used in
198198
constructors, and `delete` in destructors. Never use `malloc` or `free`.
199199

200+
# CProver conventions
201+
- Avoid if at all possible using irept methods like `get(ID_name)`, instead cast
202+
to a derived type (e.g. `class_typet`) and use the wrapper method `get_name`
203+
- Use `can_cast_type`/`can_cast_expr` instead of directly checking the `id()`
204+
of an `irept`.
205+
200206
# Architecture-specific code
201207
- Avoid if possible.
202208
- Use `__LINUX__`, `__MACH__`, and `_WIN32` to distinguish the architectures.

0 commit comments

Comments
 (0)