RFR: 8297912: HotSpot Style Guide should permit alignas (Second Proposal Attempt)

Julian Waters jwaters at openjdk.org
Fri Dec 2 13:21:06 UTC 2022


On Fri, 2 Dec 2022 08:37:07 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

> Also, @rose00 voiced concerns in the original PR ([#11315 (comment)](https://github.com/openjdk/jdk/pull/11315#issuecomment-1332982465)) which should be addressed first. I cautiously share his concerns for the moment.

I actually missed John's concerns, but it seems like @kimbarrett has already beaten me to it in remarking that there's almost no difference (if at all) between `alignas` and the different syntax `ATTRIBUTE_ALIGNED` expands to, except for the former being a little stricter in certain cases (but this is not always a bad thing). For what it's worth though, Visual C++ does explicitly mention that both the __declspec and `alignas` are identical, and [strongly encourages using the C++ keyword instead](https://learn.microsoft.com/en-us/cpp/cpp/alignment-cpp-declarations?view=msvc-170)

I feel like this is one of those instances where there isn't much that would make one lean more towards either rejecting or accepting the change, but `alignas` is somewhat better defined than the compiler extensions, which is (at least to me) a small win

-------------

PR: https://git.openjdk.org/jdk/pull/11446


More information about the hotspot-dev mailing list