[Rd] Where does L come from?
hp@ge@ @ending from fredhutch@org
Sat Aug 25 22:49:30 CEST 2018
The choice of the L suffix in R to mean "R integer type", which
is mapped to the "int" type at the C level, and NOT to the "long int"
type, is really unfortunate as it seems to be misleading and confusing
a lot of people.
The fact that nowadays "int" and "long int" have the same size on most
platforms is only anecdotal here.
Just my 2 cents.
On 08/25/2018 10:01 AM, Dirk Eddelbuettel wrote:
> On 25 August 2018 at 09:28, Carl Boettiger wrote:
> | I always thought it meant "Long" (I'm assuming R's integers are long
> | integers in C sense (iirrc one can declare 'long x', and it being common to
> | refer to integers as "longs" in the same way we use "doubles" to mean
> | double precision floating point). But pure speculation on my part, so I'm
> | curious!
> It does per my copy (dated 1990 !!) of the 2nd ed of Kernighan & Ritchie. It
> explicitly mentions (sec 2.2) that 'int' may be 16 or 32 bits, and 'long' is
> 32 bit; and (in sec 2.3) introduces the I, U, and L labels for constants. So
> "back then when" 32 bit was indeed long. And as R uses 32 bit integers ...
> (It is all murky because the size is an implementation detail and later
> "essentially everybody" moved to 32 bit integers and 64 bit longs as the 64
> bit architectures became prevalent. Which is why when it matters one should
> really use more explicit types like int32_t or int64_t.)
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages using fredhutch.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the R-devel