[Rd] simple C function segfaults
Simon Urbanek
simon.urbanek at r-project.org
Tue Feb 21 21:16:08 CET 2006
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 store
the variable in a CPU register where possible - it is not necessary
at all (most modern compiler will optimize it correctly anyway).
Crucial mistake in your example was the improper use of function
parameters and pointers.
Cheers,
Simon
More information about the R-devel
mailing list