dmd 1.046 and 2.031 releases

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Jul 16 16:14:57 PDT 2009


On Thu, Jul 16, 2009 at 6:43 PM, Jason House<jason.james.house at gmail.com> wrote:
> bearophile Wrote:
>
>> I'm playing with the new D2 a bit, this comes from some real D1 code:
>>
>> void main(string[] args) {
>>     int n = args.length;
>>     ubyte m = (n <= 0 ? 0 : (n >= 255 ? 255 : n));
>> }
>>
>> At compile-time the compiler says:
>> temp.d(3): Error: cannot implicitly convert expression (n <= 0 ? 0 : n >= 255 ? 255 : n) of type int to ubyte
>>
>> You have to add a silly cast:
>>
>> void main(string[] args) {
>>     int n = args.length;
>>     ubyte m = (n <= 0 ? 0 : (n >= 255 ? 255 : cast(ubyte)n));
>> }
>>
>> In theory if the compiler gets a smarter such cast can be unnecessary.
>>
>> Bye,
>> bearophile
>
> add it to bugzilla.

Bearophile has never reported anything in Bugzilla.  It's
inexplicable.  He constantly complains about D and does nothing to
help it.


More information about the Digitalmars-d-announce mailing list