At Fri, 18 Sep 2009 12:19:23 +0530, Sumesh P.T. wrote: > y is a const. I am facing an issue because of this. > In my calculations, I pass a structure through params; but it so happens > that y is also a member of the same structure 'params' > In order to be using the correct modified values of y for all calculations I > specify, > params->... = &y[i] > Now this gives me a warning during compilation as "warning: assignment > discards qualifiers from pointer target type" though it does the correction > calculation. Obviously it is due to the 'const' in the definition of > variable in the function func. Can some kind of typecasting help? will that > be safe?
In general, it's a good idea to follow the C constness-rules. If there is a warning about const being discarded, it is usually a sign that there is a better way to write that part of the code. It's not clear from your message what you need to do with y[i] but for example, you could make a copy of any y[] values, instead of using a pointer. Note that you can also declare a "pointer to const" in a struct, even if the struct is non-const, which would also avoid the problem. -- Brian Gough GNU Scientific Library - http://www.gnu.org/software/gsl/ _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
