DEVELOPERS.md: Reword about r_return_* conditions (#18119)

and stop confusing functions with macros.
This commit is contained in:
ratijas 2020-12-28 21:47:14 +03:00 committed by GitHub
parent 44755fe08d
commit a7e3ccf707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -103,11 +103,12 @@ if (a == b) {
example of a good name could be "out_buffer:" if the goto frees "buffer".
Avoid using GW-BASIC names like "err1:" and "err2:".
* Use `r_return_*` functions to check preconditions that are caused by
programmers' errors. Please note the difference between conditions that should
never happen, and that are handled through `r_return_*` functions, and
conditions that can happen at runtime (e.g. malloc returns NULL, input coming
from user, etc.), and should be handled in the usual way through if-else.
* Use `r_return_*` macros to check preconditions that are caused by
programmers' errors. Please, keep in mind:
* conditions that should never happen should be handled through
`r_return_*` macros;
* runtime conditions (e.g. malloc returns NULL, input coming from user,
etc.) should be handled in the usual way through if-else.
```c
int check(RCore *c, int a, int b) {