Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Suggestion for Int32.rotate
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-06 (21:02)
From: james woodyatt <jhw@w...>
Subject: [Caml-list] integer types and their literals
On Wednesday, February 6, 2002, at 10:01 , Xavier Leroy wrote:
>                   [...] We have three "big integer" types:
> int32, nativeint and int64.  A C-style syntax would be 12345L for
> int32 and 123456789LL for int64; what about nativeint?  12345N ?
> Anything nicer?

Given my heritage as a Perl and C++ hacker, my opinion may be next to 
worthless here, so I will simply observe that this would be consistent 
with other choices already made, e.g. the syntax for representing 
integer literals in hexadecimal and octal.

I think what you have proposed here would do very well.

While we're on the subject:

It would be nice to have conversion functions that raise exceptions to 
indicate overflow, i.e. converting 0x100000000LL to int32 could raise an 
exception of int32, where the value is 0L.  Do you think such functions 
belong in the standard library, or should I expect to bolt them on later?

Also, I deeply long for unsigned integer types.  I'd be happy if the 
type system included them, and required explicit conversion between 
signed and unsigned integer values.  Is there a reason Ocaml doesn't 
have unsigned integer types?

j h woodyatt <>
"...the antidote to misinformation is more information, not less."
                                                      --vinton cerf

Bug reports:  FAQ:
To unsubscribe, mail  Archives: