Byte and short Integer Literals - discussion

Reinier Zwitserloot reinier at zwitserloot.com
Mon Mar 2 04:19:36 PST 2009


rssh: Because 'b' is a legal hexadecimal character. is 0xbb:

'11 decimal as a byte literal', or is it '187 decimal as an int  
literal'?

I think 0h as a general unsigned literal prefix that will  
automatically adjust its type based on length is far superior to  
introducing a gaggle of more or less random character suffixes - while  
doing byte hackery in java is painful, it still is a relatively small  
and niche aspect of java. In theory, every language aspect needs to be  
known implicitly by all java developers because its not easy to ask  
your IDE about showing you some javadoc for such a feature. Therefore,  
it should look obvious and simple, and not like voodoo, which 0x00y  
smacks of.

Also, if you're going to go with suffixes, then for completeness sake,  
don't you need 6 suffixes total? (Byte Unsigned, Byte Signed, Short  
Unsigned, Short signed, int unsigned, long unsigned)? Just to  
highlight the mess that's going to become. Also note that the current  
suffix-L notation for long is part of a java puzzler (a minor one; l  
can be lowercase, which looks just like a 1, which is unfortunate).

  --Reinier Zwitserloot



On Mar 2, 2009, at 05:16, rssh at gradsoft.com.ua wrote:

>> http://docs.google.com/Doc?docid=dcvp3mkv_0fvz5gx7b&hl=en ) is to  
>> allow
>>
>> byte[] stuff = { 0x00y, 0x7Fy, 0x80y, 0xFFy };
>>
>
>  Why 'y', not 'b' ?
>
>
>
>
>




More information about the coin-dev mailing list