Version française
Home     About     Download     Resources     Contact us    
Browse thread
2147483648l < 2147483647l
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] 2147483648l < 2147483647l
On Tue, Jan 5, 2010 at 13:59, Matej Kosik <kosik@fiit.stuba.sk> wrote:
> Hello,
>
> I am sorry, I have a stupid question.
> I would like to ask if this:
>
>        # 2147483648l < 2147483647l;;
>        - : bool = true
>
> should not regarded as a bug. In my project I need Int32 value and above
> behavior surprised me. Value
>
>        2147483648l
>
> should not be allowed at all because it cannot be encoded to 32-bit
> signed integer encoded with 2's complement representation.
>
> Thanks in advance for help.

yes that's a "misfeature" of the lexer/parser. The point is that it
accepts -2147483648l (representable as an int32) ; the downside is
that it accepts 2147483648l and treats it as -1l.

Cf. this bug report: http://caml.inria.fr/mantis/view.php?id=4210 .

-- 
  Olivier