From edd at debian.org  Wed Mar 14 13:07:12 2018
From: edd at debian.org (Dirk Eddelbuettel)
Date: Wed, 14 Mar 2018 07:07:12 -0500
Subject: [Rd] 64-bit integer type warning on windows
In-Reply-To: <9C767F91-8EE1-4657-BDE0-639AB6757B06@gmail.com>
References: <9C767F91-8EE1-4657-BDE0-639AB6757B06@gmail.com>
Message-ID: <23209.4208.683103.472053@rob.eddelbuettel.com>


On 13 March 2018 at 17:29, Christophe DUTANG wrote:
| So, I was wondering if this warning was removable at all? Does anyone encounter this issue?

That is a pretty old topic.

Did you look into Writing R Extensions?  The first mention is

   * Do be very careful with passing arguments between R, C and FORTRAN
     code.  In particular, 'long' in C will be 32-bit on some R
     platforms (including 64-bit Windows), but 64-bit on most modern
     Unix and Linux platforms.  It is rather unlikely that the use of
     'long' in C code has been thought through: if you need a longer
     type than 'int' you should use a configure test for a C99/C++11
     type such as 'int_fast64_t' (and failing that, 'long long' (8)) and
     typedef your own type to be 'long' or 'long long', or use another
     suitable type (such as 'size_t').

     It is not safe to assume that 'long' and pointer types are the same
     size, and they are not on 64-bit Windows.  If you need to convert
     pointers to and from integers use the C99/C++11 integer types
     'intptr_t' and 'uintptr_t' (which are defined in the header
     '<stdint.h>' and are not required to be implemented by the C99
     standard but are used in C code by R itself).

     Note that 'integer' in FORTRAN corresponds to 'int' in C on all R
     platforms.

   [...]
   
   (8) but note that 'long long' is not a standard C++98 type, and C++
   compilers set up for strict checking will reject it.

so with C++11 you get by: simply make your package use 'CXX_STD = CXX11'.

Dirk

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



[Rd] 64-bit integer type warning on windows
Dirk Eddelbuettel