This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Demangle partial symbols and save memory too

On Mon, 27 Jan 2003 23:17:55 +0100, Andreas Schwab <> said:

David Carlton <> 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.
I'd rather not see such casts. It is easier to recommend no casts then to recommend no casts `but'.

The current objective for const is just with strings - getting GDB past -Wwriteable-strings so that we know that all constant strings can be moved to the text segment.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]