Skip to content
Prev 63006 / 63421 Next

R should add an API routine for safe use of memcpy(), memset() for use with 0-length SEXP

On 4/23/25 19:03, Michael Chirico wrote:
I don't think that using wrappers for this is the right approach. Even 
loading an invalid pointer is undefined behavior. While it wouldn't 
matter on typical hardware where R is used today, it could cause a crash 
on some hardware, and it may well be that various checkers will start 
warning about such things. Also, holding (intentionally) invalid 
pointers makes debugging harder.

At least in new code, I would avoid holding invalid pointers. Certainly 
I don't think we should be adding wrappers to R for C functions to make 
them work with invalid pointers.

Best
Tomas