On 5/7/05, Jacob Nelson <[EMAIL PROTECTED]> wrote:
>
> GCC knows how big an array is:
>
> jake$ cat > arrsizetest.c
> #include <stdio.h>
>
> int main()
> {
> int a[50];
> printf("sizeof a == %d\n",sizeof(a));
> return 0;
> }
> jake$ gcc arrsizetest.c
> jake$ ./a.out
> sizeof a == 200
So does ghc:
import Data.Array
main =
let a = listArray (0, 49) $ replicate 50 0
in putStrLn $ "array size == " ++ show (rangeSize $ bounds a)
[EMAIL PROTECTED]:~/src/test/haskell] $ runghc arrsize.hs
array size == 50
That doesn't mean the size is part of the *type*.
Abe
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe