
7 May
2005
7 May
'05
3:12 p.m.
On 5/7/05, Jacob Nelson
GCC knows how big an array is:
jake$ cat > arrsizetest.c #include
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) [abe@catspaw:~/src/test/haskell] $ runghc arrsize.hs array size == 50 That doesn't mean the size is part of the *type*. Abe