RFR: JDK-8312395: Improve assertions in growableArray [v2]
David Holmes
dholmes at openjdk.org
Thu Jul 20 21:44:52 UTC 2023
On Thu, 20 Jul 2023 15:30:42 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>>>
>>> I think the use of `this->xxx` is just personal style. I find it unnecessary especially given the other uses in this file.
>>>
>>
>> Interestingly enough I get compiler errors when leaving out "this->" (GCC 10.3). It may be because the member is part of a templatized base class. Odd, though.
>>
>>> Thanks.
>
>> > I think the use of `this->xxx` is just personal style. I find it unnecessary especially given the other uses in this file.
>>
>> Interestingly enough I get compiler errors when leaving out "this->" (GCC 10.3). It may be because the member is part of a templatized base class. Odd, though.
>
> Qualification with `this->` is needed in a bunch of places here because of the
> C++ name lookup rules. Unqualified name lookup does not search dependent base
> classes. For example, in GrowableArrayWithAllocator an unqualified use of
> `_len` won't find that member in the base class, but will instead (probably)
> fail to find it in namespace scope during phase1 (pre-instantiation) template
> checking lookup (of 2 phase lookup), and so fail to compile. It isn't possible
> to resolve it in phase1 because the dependent base class definition isn't
> known until instantiation.
Thanks @kimbarrett !
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14946#issuecomment-1644642974
More information about the hotspot-dev
mailing list