On 01/27/2014 07:14 PM, Rhys Ulerich wrote: >> *gsl_vector_ptr(v, i) += x > > Of course, make sure warnings about expressions without side effects > are turned on. Otherwise it may be a long debugging session before > you discover a > > gsl_vector_ptr(v, i) += x > > mistake for integer-like types. > > - Rhys >
Nice find - unfortunately since it returns a pointer to the element, you need to do: *(gsl_vector_ptr(v, i)) += x; This could lead to trouble so its probably better to have a function which does range checking, etc. I'll think a little more on a good way to do this. Thanks, Patrick
