From ripley at stats.ox.ac.uk  Thu Apr 13 17:39:27 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 13 Apr 2006 16:39:27 +0100 (BST)
Subject: [Rd] Calloc : syntax error
In-Reply-To: <44dc13910604130817n5dbc524er1770087d9109804f@mail.gmail.com>
References: <44dc13910604130817n5dbc524er1770087d9109804f@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0604131626550.25857@gannet.stats.ox.ac.uk>

On Thu, 13 Apr 2006, Franck Arnaud wrote:

> Hi,
> I have issue with Calloc : at the compilation step, gcc tells "error :
> syntax error before ')' token".
> When I use the classical C calloc... free, everything's fine.
> Here's the part of code :
> a = (double*) Calloc(*n,sizeof(double));
>
> when i remove this line or replace it with the calloc, it's ok
>
> Hint : In the header file R.h, there's a line :
> /* for PROBLEM ... Calloc, Realloc, Free, Memcpy, F77_xxxx */
> is it related ?

Please see `Writing R Extensions'.  You want

a = Calloc(*n, double);

-- 
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] Calloc : syntax error
Prof Brian Ripley