On Thu, Jul 07, 2005 at 06:29:04PM -0700, Marvin Humphrey wrote:
> Greets,
> 
> I added this line to the soldier program from the Inline C cookbook.
> 
> use Inline Config => BUILD_NOISY => 1;
> 
> ... and I exposed a bunch of warnings.  Here's one:
> 
> Soldier_396a.xs: In function `get_name':
> Soldier_396a.xs:27: warning: cast to pointer from integer of  
> different size
> 
> This is the offending line of code:
> 
> return ((Soldier*)SvIV(SvRV(obj)))->name;
> 
> My guess is that this is happening because sizeof(IV) is 8 bytes on  
> my system, but memory addressing uses 32 bits.  So the IV is overkill.

> Possible?

I think you need INT2PTR() defined and described in perl.h.

I *think* that this is correct:

  return (INT2PTR(Soldier*,SvIV(SvRV(obj))))->name;

but it's not tested.

Nicholas Clark

Reply via email to