invalid conversion from typeX** to const typeX**
Sat Dec 5 13:01:00 GMT 2015
On 5 December 2015 at 11:26, Richard Baxter wrote:
> Hi GCC dev team,
Hi, this is the wrong mailing list for questions seeking help using
GCC, please direct any follow-up to the gcc-help mailing list, thanks.
> I have developed software to parse C(++) code and automatically add
> const to function arguments (tracing all functions and their
> references). However, I have encountered an issue with the GCC/VS
> compilers preventing assignment of typeX** to const typeX**.
> Considering that const is being automatically added to the code after
> it is written, there is no danger of the situation occurring that is
> used to justify this limitation
> (http://c-faq.com/ansi/constmismatch.html). The const attribute is
> purely being used to enable programmers to know whether a variable is
> expected to be modified by the function (no checking of the
> problematic case above is required). I was wondering; is there any way
> of working around this design constraint?
In C++ you can add the const more thoroughly, changing X** to const X
* const *. I don't think that will help for C though.
More information about the Gcc-help