Thoughts on unified integer literal improvements
Alex Buckley
Alex.Buckley at Sun.COM
Wed Jul 1 14:57:37 PDT 2009
brucechapman at paradise.net.nz wrote:
> In the original autosizing which was just for hexadecimal, the size was
> specified based on the number of digits. When you extend it to decimal and octal
> as well, basing the size on number of digits gets real ugly, real fast. So "as
> small as possible" seems more natural. A leading zero digit forces zero extend
> by making it 1 bit bigger before determining the type, thereby ensuring a zero
> value high bit when the literal has a leading zero. That seems quite a natural
> thing to do as well. Obviously more work is needed on specifying that behaviour
> but I am still happy with the concept. I guess if the leading zero rule was
> dropped the only thing to be lost is the ability to create short literals less
> that 255. Thoughts?
Binary literals and unsigned int literals enhance productivity by
letting you 'write what you mean'. I see no value in inferring the type
of a literal, triggered by the 'u' suffix or not. There will come a day
when someone submits a bug claiming overload resolution is broken
because they're passing 0x007fu and think the byte overloading should be
selected rather than int. They'll be wrong, but it costs money to tell
them that.
But this is Joe's project so pay no attention to me :-)
Alex
More information about the coin-dev
mailing list