From r.hankin at noc.soton.ac.uk  Mon Apr 24 11:29:35 2006
From: r.hankin at noc.soton.ac.uk (Robin Hankin)
Date: Mon, 24 Apr 2006 10:29:35 +0100
Subject: [Rd] unsigned long long integers
Message-ID: <A0595678-8AB7-4881-8D22-5E37BC26E9CE@soc.soton.ac.uk>

Hi.

R-exts, section 1.7, discusses the passing of long long integers  
between R and C.
I want to use unsigned long long integers, but
I only need them inside a C function.

I have a  function that maps the nonnegative integers to the positive  
integers.
The function is defined by a delicate recursive algorithm that is exact
for integer arithmetic, but wildly incorrect for doubles.

The function increases rapidly with its argument, and ordinary integers
are not enough to illustrate my point (in a paper I am writing).


The C function is as follows:



void numbparts_longint(int *n, double *p){/* p(1)...p(n) calculated */
         int i,s,f,r;
         unsigned long long int *ip;
         unsigned long long int pp[*n];

/* COMPLICATED RECURSIVE ALGORITHM IN WHICH PP IS FILLED SNIPPED */

         for(i=0 ; i < *n ; i++){
                 p[i] = (double) pp[i];
         }
}



This compiles fine with "gcc -Wall" (and illustrates my point!)
but R CMD check reports


   partitions.c:180: warning: ISO C90 does not support 'long long'
   partitions.c:181: warning: ISO C90 does not support 'long long'


I really want long long integers here.  What are my options?
[the same happens with signed long long integers]





--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743



[Rd] unsigned long long integers
Robin Hankin