[Mono-list] typeof and sizeof pointer types

Malcolm Parsons malcolm.parsons@virgin.net
Mon, 26 Jul 2004 11:37:19 +0100


On Sun, Jul 25, 2004 at 08:14:20PM +0000, Alan Jenkins wrote:
> typeof (float) == typeof (float*)
> sizeof (float) == sizeof (float*)
> 
> Is this really the correct behaviour?  I can see there are problems with 
> unique types for pointers, because there is an infinite number - float, 
> float*, float**, etc - but I would have thought it would be important to get 
> sizeof right.

sizeof is correct.

both a float and a pointer to a float use 4 bytes ( on a 32 bit cpu ).

typeof is incorrect.

typeof( float    ) is System.Single
typeof( float *  ) should be System.Single*, but isn't in mono.
typeof( float [] ) is System.Single[]

-- 
Malcolm Parsons