GTY and const

Zack Weinberg zack@codesourcery.com
Tue Dec 21 19:01:00 GMT 2004


Geoffrey Keating <geoffk@geoffk.org> writes:

>> > Would it be better to add a cast around the assignment or to make
>> > the GTY code handle const members?
>> 
>> I'd prefer that you improved gengtype.
>
> It's not gengtype, the problem really is that you cannot have const
> GCed memory, for the same underlying reasons that you cannot free() a
> const pointer.

No, that's just plain not true.  cpplib makes extensive use of 'const'
to indicate write-once data structures (they are initialized through a
non-const pointer, of course).  Those definitely can be GC memory.

zw



More information about the Gcc mailing list