Re: [PATCH 00/16] Add styling to the gdb CLI and TUI

Simon Marchi
2019-03-21T15:02:06Z

> No, it's not unintended. I mentioned that in my preamble:

Sorry about that, I see it now. IMO, you could directly push a patch
that does these cleanups.

>> (Note that I took this opportunity to clean up whitespace in top.c,
>> I hope it's OK to do that as part of unrelated code changes.)
>
>> I know we plan to move to a version scheme where we don't have a
>> "patch"
>> number (a third number), but just in case, maybe we could plan for it
>> anyway
>> just in case it ever changes again in the future (I don't expect it
>> will,
>> but we never know.
>>
>> So something like MAJOR * 10000 + MINOR * 100 + PATCH * 100
>>
>> Also, it means that in your example, 9.11.90 would produce 091190. I
>> think
>> it's better if we are able to distinguish 9.11.90 from 9.12.
>
> The idea was that we don't need to distinguish between them. This
> feature is intended to be used in scripts that need to know when a
> certain feature became available, so IMO resolution below XX.YY is not
> needed, because any XX.YY.ZZ version is just a snapshot of XX.YY+1.

Ok, fair enough. Since the .90 is supposed to behave exactly how the
next version will (and then never used in production again), I'm fine
with that.

I'm just a little worried that some day we'll introduce back some
"patch" number, and then we'll need to change how this number is
encoded, which will cause some headaches :).

>> Also, we should consider doing like Python does, and encode different
>> numbers
>> in different bytes:
>>
>> https://docs.python.org/3/c-api/apiabiversion.html
>>
>> So we could say ((MAJOR << 16) | (MINOR << 8) | PATCH), for example.
>> The
>> advantage with this is that it's easy to to isolate a particular
>> number
>> using bitshifts and masks. I know it would be possible as well in
>> decimal
>> to isolate a particular number, but it's just more convenient in hex.
>
> I don't have a strong opinion, but I do have a weak one: the decimal
> "encoding" makes it much easier for humans to construct version
> numbers, they don't need to convert to hex.

There's not much difference in hex, you would just write "if
$_gdb_version >= 0x0901" for example, rather than "if $_gdb_version >=
901".

But again, my argument for hex is weak too, it's easy enough to extract
the GDB version components using some "% 100" and "/ 100". If there's
no more compelling argument for hex, I'm fine with decimal.

Simon