automatic int to short conversion - the HELL?

downs default_357-line at yahoo.de
Wed Sep 17 23:09:54 PDT 2008


Chris R. Miller wrote:
> downs wrote:
>> Jarrett Billingsley wrote:
>>> On Wed, Sep 17, 2008 at 10:26 PM, downs <default_357-line at yahoo.de>
>>> wrote:
>>>> void main() { int i; short x; x = i; }
>>>>
>>>> Excuse me, but - how exactly is it that this is in any way, shape or
>>>> form valid code?
>>>>
>>>> How can I trust a language that allows those kind of shenanigans?
>>>>
>>> lern2warningsflag.
>>
>> "Warning. Your code is broken."
>>
>> I still claim it should actually be an error, although the only
>> practical and correct solution might be full ranged type support.
> 
> I don't get it.  Why can that not be simple implicit type casting?

Because short is not a superset of int.


More information about the Digitalmars-d-learn mailing list