[Haskell-beginners] Overflow when reading C types

Michael Orlitzky michael at orlitzky.com
Mon Dec 2 22:09:22 UTC 2013


On 12/02/2013 05:05 PM, Patrick Redmond wrote:
> Yeah, the unsigned is to demonstrate how "-10" is being interpreted as a
> number before being cast to an unsigned.
> 
> My question is: Why isn't this just a read/parse error? "-10" isn't a
> valid representation for any value of the CUInt type.
> 

Sure it is,

  unsigned int x = -10;

If you don't want a CUInt, don't use a CUInt =)




More information about the Beginners mailing list