This is the mail archive of the
mailing list for the GDB project.
Re: RFC: Demangle partial symbols and save memory too
On Mon, 27 Jan 2003 23:17:55 +0100, Andreas Schwab <email@example.com> said:
> David Carlton <firstname.lastname@example.org> writes:
>> I also toyed with trying to replace 'struct XXX *' with 'const
>> struct XXX *' wherever appropriate. That one's harder, though,
>> because there are structures in GDB where values are computed
>> lazily and cached: so not only are there functions that are
>> logically const but not actually const, but I also worried that
>> making too many declarations const now would inhibit such caching
>> in the future. Maybe in a couple of years we can switch GDB over
>> to C++ instead of C and use 'mutable'...
> Even in C casting away const is OK as long as the object isn't
> read-only in the first place. You just have to be careful to make
> sure this is not violated.
That's a good point. I don't like casts, of course, but in this
particular situation my dislike of casts might be trumped by my liking
of const when logically appropriate.