automatic int to short conversion - the HELL?
Chris R. Miller
lordsauronthegreat at gmail.com
Thu Sep 18 11:33:21 PDT 2008
downs wrote:
> 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.
Well.... then it's just a loss of precision warning like on every other
language (Java and C++ off the top of my head).
-w and be on thy way, unless I'm missing something else.
More information about the Digitalmars-d-learn
mailing list