Re: [Rd] Strange behavior of C compiled program

2009-02-09 Thread Duncan Murdoch
On 09/02/2009 4:05 AM, Christophe Genolini wrote: Thanks, that was a stupid mistake (I did not know that this is so important). So I still have a problem realy more complex and I do not know was is wrong. I am running a .C procedure in a R loop. After 4, 5 or sometimes 6 call to the C procedur

Re: [Rd] Strange behavior of C compiled program

2009-02-09 Thread Mathieu Ribatet
You might have a look at the "Writing R Extensions" manual - especially valgrind and/or gdb. By the way, your error is probably due to array size problem - i.e. tmp is of size n and you call tmp[n+1] for example. Valgrind will detect in automagically for you. Best, Mathieu Le lundi 09 février 20

Re: [Rd] Strange behavior of C compiled program

2009-02-09 Thread Christophe Genolini
Thanks, that was a stupid mistake (I did not know that this is so important). So I still have a problem realy more complex and I do not know was is wrong. I am running a .C procedure in a R loop. After 4, 5 or sometimes 6 call to the C procedure, Rgui crash (it closes asking me if I want to se

Re: [Rd] Strange behavior of C compiled program

2009-02-08 Thread Mathieu Ribatet
Hi Christophe, The problem might be that you used %d when printing. I guess that your variables dist and tmp are double so you have to use %f instead. Best, Mathieu Le dimanche 08 février 2009 à 23:37 +0100, Christophe Genolini a écrit : > Hi the list, > > I need to include some C code in R, bu

Re: [Rd] Strange behavior of C compiled program

2009-02-08 Thread Duncan Murdoch
On 08/02/2009 5:37 PM, Christophe Genolini wrote: Hi the list, I need to include some C code in R, but the behavior of the C code is strange : Here is my code : --- 8< --- Rprintf("\n mTraj=%f mClus=%f",mTraj[i+nbId*c],mClustersCenter[j+nbClusters*c]); Rprintf("\nDistA=%d Tmp=%