Skip to content

conv() example in R-exts

2 messages · robin hankin, Brian Ripley

#
Hi

[I'm not sure if this is "intelligible to non-programmers" or not]

R-exts  (section 4.2) gives an example  of the .C() function whose 
third argument is

"as.integer(length(a))",

and urges the user to coerce all the arguments to the correct form 
(on pain of  "hard-to-catch errors"
which I now know to be very appropriate, if understated,  phrasing).

  The length()  function returns an integer, according to the helppage.

So, why does the argument above use as.integer()?
#
On Mon, 8 Nov 2004, Robin Hankin wrote:

            
Not, I suspect:  R-exts is not intended to be.
Because things written on help pages can change.

There *is* a potential issue here, as 64-bit platforms could support
longer vectors than an R integer can represent.  I suspect before too long
we will need a `size' type for lengths.  Already object.size() has been 
changed to return a double, not an integer, since people are created 
objects of more than 2Gb in size.