From maechler at stat.math.ethz.ch  Thu Apr 13 17:35:38 2006
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Thu, 13 Apr 2006 17:35:38 +0200
Subject: [Rd] Calloc : syntax error
In-Reply-To: <44dc13910604130817n5dbc524er1770087d9109804f@mail.gmail.com>
References: <44dc13910604130817n5dbc524er1770087d9109804f@mail.gmail.com>
Message-ID: <17470.28618.279553.540878@stat.math.ethz.ch>

>>>>> "Franck" == Franck Arnaud <franck.arnaud at gmail.com>
>>>>>     on Thu, 13 Apr 2006 17:17:14 +0200 writes:

    Franck> Hi, I have issue with Calloc : at the compilation
    Franck> step, gcc tells "error : syntax error before ')'
    Franck> token".  When I use the classical C calloc... free,
    Franck> everything's fine.  Here's the part of code : a =
    Franck> (double*) Calloc(*n,sizeof(double));

    Franck> when i remove this line or replace it with the
    Franck> calloc, it's ok

    Franck> Hint : In the header file R.h, there's a line : /*
    Franck> for PROBLEM ... Calloc, Realloc, Free, Memcpy,
    Franck> F77_xxxx */ is it related ?

not at all.
    Franck> Does anyone know ?  

yes, everyone even who carefully looks at the corresponding
section in the  "Writing R Extensions" manual.

Calloc() is used in many places in R and contributed packages.

Hint: It's usage syntax is *different* and slightly simpler
      than the one you used above.
Hint2: A typical use is  ' Calloc(n, double); '

    Franck> 	[[alternative HTML version deleted]]

Hint3: Read the posting guide 
       http://www.r-project.org/posting-guide.html
       in order not to produce such as the above line 

Regards, and  Happy Easter (to all in the audience),
Martin Maechler, ETH Zurich



[Rd] Calloc : syntax error
Martin Maechler