Why convert to pointer type before added to a pointer

Jie Zhang zhangjie@magima.com.cn
Wed Aug 18 05:30:00 GMT 2004


Hi Rup,

>>   n.0 = (unsigned int)n;
>>   T.1 = n.0 * 4;
> 
> 
> Compute the byte-offset for the index as an unsigned integer.
> 
> 
> Performing the index computation as unsigned looks wrong to me. I suspect
> this because sizeof(int) is unsigned, but isn't a[-1] acceptable? I can't
> navigate the C standard well enough to see what it says.
> 

I also think we should not compute the index as unsigned. I think C99 
accepts a[-1].


cheers
-- 
Jie



More information about the Gcc mailing list