-funswitch-loops not effective?
Giovanni Bajo
rasky@develer.com
Tue Jan 18 19:57:00 GMT 2005
Mark Mitchell <mark@codesourcery.com> wrote:
>>> Of course, this doesn't say where there is the well-formed
>>> leak of a pointer to the const member in the class in the first
>>> place:
>>>
>>> class Foo {
>>> public:
>>> Foo(bool b) : flag(b) {}
>>> bool get() const { return flag; }
>>> private:
>>> const bool flag;
>>> };
>>>
>>> Is there a well-formed way to write to Foo::flag?
>
> Yes -- but only during the constructor for Foo. After that point, it
> cannot change.
Actually, to clarify, only within the member initialization list of Foo's
constructor, where you can explicitally call the const member's constructor.
After that, the body of the construct of Foo is no different from other
member functions, in that it cannot modify the const member's contents.
--
Giovanni Bajo
More information about the Gcc
mailing list