Skip to content

Commit ba01589

Browse files
author
thk123
committed
Add guidelines for using irepts in the code base
1 parent 392c765 commit ba01589

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
@@ -194,6 +194,12 @@ Formatting is enforced using clang-format. For more information about this, see
194194
which safely manages the pointer. As such, `new` should only be used in
195195
constructors, and `delete` in destructors. Never use `malloc` or `free`.
196196

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

0 commit comments

Comments
 (0)