Why does assert not work here?

后端 未结 3 1537
清歌不尽
清歌不尽 2021-01-05 17:04

Here is the code:

#include 
#include 
#include 
#include 

using namespace Rcpp;


// [[Rcpp::ex         


        
3条回答
  •  攒了一身酷
    2021-01-05 17:49

    Note that assert() etc are explicitly prohibited for CRAN uploads. Quoting from the CRAN Repo Policy page:

    The code and examples provided in a package should never do anything which might be regarded as malicious or anti-social. The following are illustrative examples from past experience.

    • Compiled code should never terminate the R process within which it is running. Thus C/C++ calls to assert/abort/exit, Fortran calls to STOP and so on must be avoided. Nor may R code call q().

    So the answer about debug mode is technically correct, but also note that you are not supposed to use this if you plan to upload CRAN at some point.

提交回复
热议问题