On Wed, 03 Jun 2009 02:20:33 -0400, Tim Matthews <[email protected]> wrote:

Paul D. Anderson wrote:
The behavior is consistent with the specification -- see http://www.digitalmars.com/d/1.0/type.html.
 Most C-based languages will do the same.


You are slightly missing the point. The point is byte should be unsigned and a separate name for signed. Dot net actually has Byte for unsigned and SByte for signed so its harder to make that error. Too late to change now though.

Count me as one of the people who sees byte as signed. In fact, C# confused me when I wanted to use an unsigned byte, and couldn't find ubyte. I think it all depends on what you learned first.

Making byte unsigned and introducing sbyte would go against the current convention of "without a u is signed, with a u is unsigned".

BTW, with C#, the following code results in an error:

        static void Main(string[] args)
        {
            uint v;
            v = 31234;
            sbyte t = -1;
            v |= t;
            Console.Out.WriteLine(v);
        }

Eror: Cannot implicitly convert type 'sbyte' to 'uint'. An explicit conversion exists (are you missing a cast?)

I would be in favor of a similar behavior in D.

-Steve

Reply via email to