RFR: 8166651: OrderAccess::load_acquire &etc should have const parameters

Kim Barrett kim.barrett at oracle.com
Thu May 25 19:51:07 UTC 2017


> On May 25, 2017, at 4:44 AM, David Holmes <david.holmes at oracle.com> wrote:
> 
> Hi Kim,
> 
> On 25/05/2017 9:42 AM, Kim Barrett wrote:
>> Please review this change to Atomic::load and OrderAccess::load_acquire
>> overloads to make their source const qualified, e.g. instead of
>> "volatile T*" make them "const volatile T*".  This eliminates the need
>> for casting away const when, for example, applying one of these
>> operations to a member variable when in a const-qualified method.
> 
> This looks quite reasonable - thanks - provided ...
> 
>> There are probably places that previously required casting away const
>> but now do not. Similarly, there are probably places where values
> 
> ... our compilers do not complain about unnecessary casts :)

We’re in serious trouble if that starts happening; the number of unnecessary casts
in our code seems to be legion :(

Of course, I have this pipe-dream of someday turning on -Wold-style-cast :)



More information about the hotspot-dev mailing list