Why are unsigned to signed conversions implicit and don't emit a warning?

SimonM user at example.net
Mon Apr 11 01:10:05 PDT 2011


On 2011/04/11 09:31 AM, spir wrote:
> On 04/11/2011 02:42 AM, bearophile wrote:
>> I and Don have asked (in Bugzilla and elsewhere) to change the
>> built-in names into sbyte and ubyte, to avoid the common confusions
>> between signed and unsigned bytes in D, but Walter was deaf to this.
>
> I think a good naming scheme would be:
>
> * signed : int8 .. int64
> * unsigned : nat8 .. nat64
>
> (since "natural number" more or less means "unsigned integer number")
> already. What do you think?
I like the idea of removing all the different integer type names (byte, 
short, int, long, cent) and replacing them with int8..int64 (I'd still 
prefer uint8..uint64 though).

Then you could use just 'int' to specify using the current system's 
architecture (and hopefully replace the ugly size_t type). I also think 
it makes more sense to just use 'int' when you don't really care about 
the specific size of the value. Unfortunately it would break backwards 
compatility so it would never make it into D's current state.


More information about the Digitalmars-d-learn mailing list