On Tue, 7 Mar 2023 05:58:57 GMT, Kim Barrett <[email protected]> wrote:
>> No I'm comparing the syntax used elsewhere:
>>
>> DebuggingContext debugging{};
>>
>> with that used here:
>>
>> DebuggingContext debugging;
>>
>> why the braces in most cases but not here?
>
> "syntax used elsewhere" are declarations of local variables initialized with
> _value initialization_ (which is _default initialization_ for this type).
> "that used here" is a member variable declaration in the Command class, where
> the initialization occurs elsewhere (in the constructor of the Command class
> [*]). They are entirely different syntactic entities. Does that help? Or
> am I still not understanding your question?
>
> [*] With C++11, data members can have default initializers, but that's not an
> approved feature for HotSpot.
Sorry I was fixated on the weirdness (to me) of the {} initialization. I missed
the fact these were different kinds of declarations.
-------------
PR: https://git.openjdk.org/jdk/pull/12845