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

2011-04-11 Thread Andrej Mitrovic
There are some aliases in std.stdint

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

2011-04-11 Thread spir
On 04/11/2011 10:10 AM, SimonM wrote: 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 Walt

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

2011-04-11 Thread SimonM
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 n

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

2011-04-11 Thread Andrew Wiley
On Sun, Apr 10, 2011 at 7:57 PM, Jonathan M Davis wrote: >> Andrej Mitrovic: >> > I just had a little bug in my code. In the WindowsAPI, there's this >> > alias: >> > >> > alias ubyte BYTE; >> > >> > Unfortunately I didn't check for this, and I erroneously assumed BYTE was >> > a signed value (bla

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

2011-04-11 Thread spir
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

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

2011-04-10 Thread Jonathan M Davis
> Andrej Mitrovic: > > I just had a little bug in my code. In the WindowsAPI, there's this > > alias: > > > > alias ubyte BYTE; > > > > Unfortunately I didn't check for this, and I erroneously assumed BYTE was > > a signed value (blame it on my lack of coffee). > > I and Don have asked (in Bugzi

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

2011-04-10 Thread bearophile
Andrej Mitrovic: > I just had a little bug in my code. In the WindowsAPI, there's this alias: > > alias ubyte BYTE; > > Unfortunately I didn't check for this, and I erroneously assumed BYTE was a > signed value (blame it on my lack of coffee). I and Don have asked (in Bugzilla and elsewhere) t

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

2011-04-10 Thread Andrej Mitrovic
And I just remembered Tuples can be constructed just like regular structs (which they are underneath): RGBTuple GetRGB(COLORREF cref) { return RGBTuple(GetRValue(cref), GetGValue(cref), GetBValue(cref)); }

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

2011-04-10 Thread Andrej Mitrovic
I just had a little bug in my code. In the WindowsAPI, there's this alias: alias ubyte BYTE; Unfortunately I didn't check for this, and I erroneously assumed BYTE was a signed value (blame it on my lack of coffee). So when I used code like this: alias Tuple!(byte, "red", byte, "green", byte, "b