Re: [Rd] simple C function segfaults

2006-02-21 Thread Prof Brian D Ripley
On Tue, 21 Feb 2006, Simon Urbanek wrote: > > On Feb 21, 2006, at 2:48 PM, Bernd Kriegstein wrote: > >> Thank you very much for the answer. As a general principle, when >> and why should I register the counters? > > "register int i" is merely an optimization, you can safely use "int > i" instead.

Re: [Rd] simple C function segfaults

2006-02-21 Thread Simon Urbanek
On Feb 21, 2006, at 2:48 PM, Bernd Kriegstein wrote: > Thank you very much for the answer. As a general principle, when > and why should I register the counters? "register int i" is merely an optimization, you can safely use "int i" instead. The "register" keyword only tells the compiler to

Re: [Rd] simple C function segfaults

2006-02-21 Thread Bernd Kriegstein
Thank you very much for the answer. As a general principle, when and why should I register the counters? Should I do the same in matrices or other parameters that I pass and alter in the main body of the C function? Thanks again, - b. --- Paul Roebuck <[EMAIL PROTECTED]> schrieb: > On Tue, 21 F

Re: [Rd] simple C function segfaults

2006-02-20 Thread Paul Roebuck
On Tue, 21 Feb 2006, Bernd Kriegstein wrote: > I use the simplest of examples that somebody can think > of in order to generate a matrix of random numbers > from within C, calling appropriate R functions. The > concrete example is below: > [SNIP] -- pico.c #include #include #includ

Re: [Rd] simple C function segfaults

2006-02-20 Thread Bernd Kriegstein
Berwin thanks, I tried that, but it didn't work. There is a conflict in using a pointer for the operation defined in the #define. The error message is: pico.c:17: warning: comparison between pointer and integer Suppose that I use pointers for n and m. What should I alter in the program in order f

Re: [Rd] simple C function segfaults

2006-02-20 Thread Berwin A Turlach
> "BK" == Bernd Kriegstein <[EMAIL PROTECTED]> writes: BK> void pico ( double *y, int n, int m ) ^ Everything is passed from R to C as pointer, so these should be pointers. Hope this helps. Cheers, Berwin __