[PUSHED][PATCH] convert table.hxx use in editeng/inc/editeng/forbiddencharacterstable.hxx

Kohei Yoshida kohei.yoshida at gmail.com
Thu Feb 16 13:07:36 PST 2012


On Thu, Feb 16, 2012 at 4:01 PM, Michael Meeks <michael.meeks at suse.com> wrote:
>
> On Thu, 2012-02-16 at 15:20 -0500, Kohei Yoshida wrote:
>> > Is it a safe code?
>> >
>> >      pForbiddenCharacters = &maMap[ nLanguage ];
>> >      return pForbiddenCharacters;
> ...
>> So, in theory, taking the address of a returned object which itself is a
>> reference to the instance stored in the container is very much safe.
>
>        I guess :-) I imagine the real problem here is that any kind of
> operation on the stl container could then realloc the underlying memory
> in some way, busting the reference / pointer you handed out elsewhere;
> so it looks only transiently safe to me ;-)

Of course.  If the content of the container changes all bets are off.
But I thought that was a given in this context (the same way all
associated iterators are invalid once the state of the container
changes).

My understanding of the question was, does the address of the object
point to the real object inside the container or a temporary object?
And my answer was it points to the real object inside the container.
I didn't mean to insinuate anything else. Sorry if I gave such
impression.

Kohei


More information about the LibreOffice mailing list