Re: [Rd] simple C function segfaults

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Tue 21 Feb 2006 - 20:16:08 GMT

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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Feb 22 07:32:45 2006

This archive was generated by hypermail 2.1.8 : Tue 21 Feb 2006 - 22:34:55 GMT