Re: invalid conversion from typeX** to const typeX**

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux