This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
invalid conversion from typeX** to const typeX**
- From: Richard Baxter <richardbrucebaxter at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 5 Dec 2015 22:26:32 +1100
- Subject: invalid conversion from typeX** to const typeX**
- Authentication-results: sourceware.org; auth=none
Hi GCC dev team,
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?
Thanks for your help.
Best Regards,
Richard Baxter