cast question

Art Boyne boyne at hplvli.HP.COM
Wed Feb 1 01:12:44 AEST 1989


jd at csd4.milw.wisc.edu (James R Drinkwater) asks:

> Will I  run into any problems with the following:
> 
> 	struct something *ptr;
> 	...
> 		func((int)ptr);
> 	...
> 	func(arg)
> 	int arg;
> 	{
> 		...
> 		return(arg);
> 	}

Certainly will, on machines where sizeof(pointer) > sizeof(int).
The implementation of C for the 68000 I've been using for the
last five years has sizeof(pointer)=sizeof(long)=32 bits and
sizeof(int)=16 bits.

Art Boyne     boyne at hplvla.HP.COM



More information about the Comp.lang.c mailing list