This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: const gsl_vector *


On 08/19/2014 03:18 AM, John D Lamb wrote:

I mainly use C++. But I think C now works so that you could use

gsl_vector* const v

in place of a

const gsl_vector* v

argument, and get the desired result.

I don’t know if there would be unintended consequences of rewriting the
arguments of the GSL functions this way. I know that C can’t handle both of

int function( const gsl_vector* v );
int function( gsl_vector* const v );

in the same code. So it would need a rewrite.

One issue would be that if the code were rewritten any code that passed
a const gsl_vector* argument would cause a compilation failure. The
workaround might be to use a

gsl_vector const* const v

argument. But I don’t know if that would cause problems, for example
with older compilers.


I don't have a solution to this problem, but with my gcc (4.4.7), changing to gsl_vector* const doesn't fix the issue. Compiling with -Wall -W produces no warnings and the program runs as before.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]