Re: [Rd] unsigned long long integers

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 24 Apr 2006 - 09:43:05 GMT

R-admin recommends -std=gnu99, which will solve this.

Given that long and long long mean different things on different platforms, I would endorse the recommendation to use a C99 explicit type.

On Mon, 24 Apr 2006, Robin Hankin wrote:

> 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
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon Apr 24 19:46:51 2006

This archive was generated by hypermail 2.1.8 : Mon 24 Apr 2006 - 10:17:55 GMT