[R-pkg-devel] R_registerRoutines, etc.

Dirk Eddelbuettel edd at debian.org
Mon Apr 24 00:31:41 CEST 2017

On 24 April 2017 at 10:18, Rolf Turner wrote:
| One more (I hope it's the last!) question:
| One of my subroutines has an argument of type *logical*.  There is no 
| logical type in C.  So, since I am perforce using C-speak, I cannot 
| change "void *" to "void logical".
| I have a (very vague) understanding that in C one uses variables of int 
| type (taking the values 0, for FALSE, and 1, for TRUE) as logical variables.
| On that understanding I took a punt and replaced "void *" by "int *" for
| the logical type variable.  The package built and passed
|      "R CMD check --as-cran"
| so it seems that this is OK.  Is this the Right Thing To Do?  Are there 
| any (obvious?) lurking perils?

I think you are allowed to use C99 [1] which has it -- see eg



[1] Section 1.6.4 opems with

    1.6.4 Portable C and C++ code

    Writing portable C and C++ code is mainly a matter of observing the
    standards (C99, C++98 or where declared C++11/14) and testing that
    extensions (such as POSIX functions) are supported.

http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the R-package-devel mailing list