RFR: 8067306: Improve STATIC_ASSERT

Kim Barrett kim.barrett at oracle.com
Sun Jan 11 04:46:23 UTC 2015


On Jan 9, 2015, at 8:48 AM, Coleen Phillimore <coleen.phillimore at oracle.com> wrote:
> 
> 
> On 1/9/15, 8:45 AM, Coleen Phillimore wrote:
>> 
>> This looks like a good change.   I didn't realize we had STATIC_ASSERT.   Is there any supporting opinion to make it lower case so it doesn't scream at you in the code?

It was added a little less than two years ago, and is only used in a half dozen places so far.
I was wanting one and was going to add it, then discovered we already had one, just not
quite what I needed.

> Never mind. It's very macro.  It should probably stay uppercase.

Also, static_assert (lower case) is a C++11 keyword.  It’s a special operator that provides a
similar feature, although the C++11 operator takes two arguments, the condition constant
expression and a string literal message.  We wouldn't want to have to rename ours again
later…

Note that our macro doesn’t have a message string because there isn’t a good way to get
such into the compiler error message.  It might be possible to do something with an identifier
and preprocessor token pasting if we really felt the need, but since its a build time failure its
usually sufficient to just go look at the source line (hopefully) indicated in the compiler error.



More information about the hotspot-runtime-dev mailing list