[Rd] longint

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Wed Aug 15 13:48:23 CEST 2018


On 15/08/2018 7:08 AM, Benjamin Tyner wrote:
> Hi
> 
> In my R package, imagine I have a C function defined:
> 
>      void myfunc(int *x) {
>         // some code
>      }
> 
> but when I call it, I pass it a pointer to a longint instead of a
> pointer to an int. Could this practice potentially result in a segfault?

I don't think the passing would cause a segfault, but "some code" might 
be expecting a positive number, and due to the type error you could pass 
in a positive longint and have it interpreted as a negative int.

Duncan Murdoch



More information about the R-devel mailing list