This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiling GCC With a C++ Compiler (g++)
Gabriel Dos Reis <gdr@cs.tamu.edu> writes:
> The fact that the subboject is part of a "whole writebale" object does
> not make the subobject suddenly writable.
But it is writable in the first place. Just because a const-qualified
lvalue is used in some places does not make the object suddenly read-only.
> Looking more closely the language in 6.3.2.1.
>
> [#1] An lvalue is an expression with an object type or an
> incomplete type other than void;53) if an lvalue does not
> designate an object when it is evaluated, the behavior is
> undefined. When an object is said to have a particular
> type, the type is specified by the lvalue used to designate
> the object. A modifiable lvalue is an lvalue that does not
> have array type, does not have an incomplete type, does not
> have a const-qualified type, and if it is a structure or
> union, does not have any member (including, recursively, any
> member or element of all contained aggregates or unions)
> with a const-qualified type.
>
>
> This language makes any lvalue whose type is whole tree_string
> non-modifiable (this rule is very different from C++).
... through that const-qualified lvalue. But you can create a different
lvalue (by casting) through which you can modify the object.
> Interestingly, while this appear in the section on "restrict", it
> gives you food for thought
I don't see any restrict qualification here.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."