From bill at insightful.com  Wed Jun  4 21:25:04 2008
From: bill at insightful.com (Bill Dunlap)
Date: Wed, 4 Jun 2008 12:25:04 -0700 (PDT)
Subject: [Rd] Splus/R typedef for C equivalent of S "integer"
Message-ID: <Pine.GSO.4.56.0806041159280.791@octopus>

We've been working on making it easier to write
packages that work in both R and Splus.  One issue
is that R and Splus use different internal representations
of integers and this makes a difference on their 64-bit
versions: R uses ints (32 bits on 32-bit and 64-bit versions
of R) and Splus uses longs (32 bits on 32-bit Splus and
64 bits on 64-bit Splus).  The obvious ways to deal with
the difference are to use a typedef or a #define to map
those to a common name.  I think it would be handy to
put this definition into R.h or some other R header file
(Splus now has an R.h and other header files with the R
names that we recommend for all package work.)

Should this be a typedef or a #define?  What should its
name be?

There is a file, RSCommon.h (from omegahat?), that I've seen
in a few packages which uses a typedef, RSInt, for this.
Repeated typedefs, even with the same definition, are illegal
so putting typedef ... RSInt into R.h would break those packages.
(C doesn't yet have an if-typedef-exists or untypedef construct,
does it?)

I like XXXinteger, since it refers to the R/Splus name of
the class, "integer", instead of the C-like name.  Should
the "XXX" prefix be "RS" or "RSplus" or "S"?

I like typedefs since you can use them in the debugger.
Should a typedef be accompanied by a #define XXXinteger_defined
so one can write code that works on older versions of R or
Splus without the typedef?

I think R.h would be a good place for it, but I don't
have strong feeling about that one.

If we can come to a consensus on the name, typedef/#define,
and which *.h file, I can put it into Splus.

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."



[Rd] Splus/R typedef for C equivalent of S "integer"
Bill Dunlap