This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why convert to pointer type before added to a pointer


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]