From ripley at stats.ox.ac.uk  Mon Apr 24 11:43:05 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 24 Apr 2006 10:43:05 +0100 (BST)
Subject: [Rd] unsigned long long integers
In-Reply-To: <A0595678-8AB7-4881-8D22-5E37BC26E9CE@soc.soton.ac.uk>
References: <A0595678-8AB7-4881-8D22-5E37BC26E9CE@soc.soton.ac.uk>
Message-ID: <Pine.LNX.4.64.0604241040490.20578@gannet.stats.ox.ac.uk>

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

-- 
Brian D. Ripley,                  ripley at 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



[Rd] unsigned long long integers
Prof Brian Ripley