Re: [Rd] malloc/calloc/strdup and R's aequivalents

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Sun, 18 Mar 2012 08:19:06 -0500

On 18 March 2012 at 06:16, oliver wrote:
| > R> library(inline)
| > R>
| > R> f <- cfunction(signature(), verbose=TRUE, body='
| > + double *p = Calloc(5, double);
| [...]
|
| That line cleared the issue.
| Thank you for providing an example.
|
| When reading in the documentation I was not sure,
| how to interpret "type" in setion 6.1.2.
|
| It was meant as the name of the type, and that's, why my
| sizeof() stuff created the problem.
|
| I tried around and then saw, that the name of the type
| is accepted, not only with typical base-types of C, but
| it also eats the names of my structs/typedefed structs.

Understandable, the manual is not toi clear there. The easiest answer, in such cases, is IMHO provided by other source packages.

Too bad the Google Code Search is now defunct. But besides a recursive grep in R's src/ directory, a simple Google search for "site:r-project.org Calloc" also brings the solution up rightaway.

Dirk

-- 
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun 18 Mar 2012 - 13:21:26 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 18 Mar 2012 - 14:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive