RFR: 8067306: Improve STATIC_ASSERT

Stefan Karlsson stefan.karlsson at oracle.com
Fri Dec 19 10:11:39 UTC 2014


On 12/12/14 18:04, Kim Barrett wrote:
> On Dec 12, 2014, at 6:47 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
>> On 2014-12-12 08:30, Kim Barrett wrote:
>>> Please review this enhancement to the hotspot STATIC_ASSERT() macro.
>>>
>>> […]
>>>
>>> CR:
>>> https://bugs.openjdk.java.net/browse/JDK-8067306
>>>
>>> Webrev:
>>> http://cr.openjdk.java.net/~kbarrett/8067306/webrev/
>> Why do you use '(cond) ? true : false' instead of just '(cond)'?
>>
>> 243     STATIC_ASSERT_FAILURE< (Cond) ? true : false >::value ] \
> Paranoia regarding ancient tool chains.  There are purportedly some
> which don't do the implicit conversion to bool properly in this
> context.  I don't know if we actually care about such...

Would it just not compile or would it produce the wrong answer? If it 
just wouldn't compile I don't think we should add this extra line noise. 
If we encounter a problem with it we'll find out and then we can add 
this workaround. The previous code already worked with only <cond>.

StefanK

>
>> Why do you have this line at the end of the define:
>>
>> 244   /* */
> Force of habit; this is something I picked up ages ago, providing an
> easy to spot marker for the end of a multi-line macro body.  I don't
> mind removing it.
>
> Hm, I also forgot to right adjust all the line continuation markers,
> which seems to be the preferred style in hotspot code.  I've never
> liked that sort of formatting thing because it can lead to unnecessary
> (and potentially large) diff expansion during maintenance, but it *is*
> the local style...
>



More information about the hotspot-gc-dev mailing list