Dear all,

hoping this is the right place for this:
I stumbled upon documentation regarding the use of `assert` in C++ code, in
particular, https://cran.r-project.org/web/packages/policies.html states
that

```
Thus C/C++ calls to assert/abort/exit/std::terminate, Fortran calls to STOP
and so on must be avoided.
```

, which goes against all best practice guidelines I'm aware of.
Therefore I would propose to remove 'assert' from the above statement.
In support, https://cran.r-project.org/doc/manuals/r-release/R-exts.html
states that 

``` 
One usage that could call abort is the assert macro in C or C++ functions,
which should never be active in production code. The normal way to ensure
that is to define the macro NDEBUG, and R CMD INSTALL does so as part of the
compilation flags.
```
which seems a reasonable thing to do.

As a sidenote, the guide could be extended to encourage new mechanisms
available in modern C++ like `static_assert`.


Cheers
Chris

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to