Why convert to pointer type before added to a pointer

Falk Hueffner hueffner@informatik.uni-tuebingen.de
Wed Aug 18 06:38:00 GMT 2004


Jie Zhang <zhangjie@magima.com.cn> writes:

>>>   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].

Well, it doesn't matter as long as it's done at the same width as that
of pointers.

-- 
	Falk



More information about the Gcc mailing list