This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why convert to pointer type before added to a pointer
- From: Falk Hueffner <hueffner at informatik dot uni-tuebingen dot de>
- To: Jie Zhang <zhangjie at magima dot com dot cn>
- Cc: Rupert Wood <me at rupey dot net>, gcc at gcc dot gnu dot org
- Date: Wed, 18 Aug 2004 07:30:29 +0200
- Subject: Re: Why convert to pointer type before added to a pointer
- References: <E1BwelD-0005iV-0X@anchor-post-33.mail.demon.net><4122BA8E.90709@magima.com.cn>
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