On Sun, 21 Jul 2024 08:55:35 GMT, Johan Sjölen <[email protected]> wrote:
>> @jdksjolen
>>
>>> Also, @SoniaZaldana, would you mind changing the code to this
>>
>> Even simpler (did not test, but you get my drift):
>>
>>
>> #define ALL_TYPES_DO_XX(what) \
>> what(char*, "STRING") \
>> what(NanoTimeArgument, NANOTIME) \
>> what(jlong, "JLONG")
>> ... etc
>>
>> then
>>
>>
>> #define XX(TYPE, NAME) \
>> if (strcmp(type, NAME) == 0) { \
>> DCmdArgument<TYPE>* argument = new DCmdArgument<TYPE>(name, desc, NAME,
>> mandatory, mandatory, default_value); \
>> }
>> ALL_TYPES_DO_XX(XX)
>> #undef XX
>>
>>
>> ;-)
>
> Sonia, my bad if you already know this stuff but since it's fairly esoteric
> knowledge nowadays I'd like to help you out in advance: Thomas is proposing
> the usage of a X macro https://en.wikipedia.org/wiki/X_macro
>
> These can be found throughout Hotspot, you can find an example definition and
> usage in `logTag.hpp` and `logTag.cpp`.
@SoniaZaldana Note that this is very much optional.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20198#discussion_r1685701779