Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

define STRICT_R_HEADERS to avoid definition of Free, ... #898

Closed
@romainfrancois

Description

@romainfrancois

When this macro is not defined, R headers do define macros with very generic names, such asFree for S-PLUS back compatibility:

https://github.com/wch/r-source/blob/trunk/src/include/R_ext/RS.h#L70

#ifndefSTRICT_R_HEADERS/* S-PLUS 3.x but not 5.x NULLs the pointer in the following */#defineCalloc(n,t)   (t *) R_chk_calloc( (R_SIZE_T) (n), sizeof(t) )#defineRealloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (R_SIZE_T)((n) * sizeof(t)) )#defineFree(p)        (R_chk_free( (void *)(p) ), (p) = NULL)#endif

https://github.com/wch/r-source/blob/trunk/src/include/R_ext/RS.h#L49

#ifndefSTRICT_R_HEADERS#defineR_PROBLEM_BUFSIZE4096/* Parentheses added for FC4 with gcc4 and -D_FORTIFY_SOURCE=2 */#definePROBLEM{char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,#defineMESSAGE                 {char R_problem_buf[R_PROBLEM_BUFSIZE];(sprintf)(R_problem_buf,#defineERROR),error(R_problem_buf);}#defineRECOVER(x)),error(R_problem_buf);}#defineWARNING(x)),warning(R_problem_buf);}#defineLOCAL_EVALUATOR/**/#defineNULL_ENTRY/**/#defineWARNWARNING(NULL)#endif

Andhttps://github.com/wch/r-source/blob/trunk/src/include/R_ext/Constants.h#L35

#ifndef STRICT_R_HEADERS#definePI             M_PI#include<float.h>/* Defines the rest, at least in C99*/#defineSINGLE_EPS     FLT_EPSILON#defineSINGLE_BASE    FLT_RADIX#defineSINGLE_XMIN    FLT_MIN#defineSINGLE_XMAX    FLT_MAX#defineDOUBLE_DIGITS  DBL_MANT_DIG#defineDOUBLE_EPS     DBL_EPSILON#defineDOUBLE_XMAX    DBL_MAX#defineDOUBLE_XMIN    DBL_MIN#endif

For example theFree macro was making noise in arrow:romainfrancois/arrow@79c5001#diff-65a2f88d0196bb912b5ba669f5792492R20

So, should Rcpp havedefine STRICT_R_HEADERS somewhere ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp