[cfe-commits] implicit sign/bitwidth conversions during array indexing?
Eli Friedman
eli.friedman at gmail.com
Fri Nov 14 11:00:32 PST 2008
On Thu, Nov 13, 2008 at 6:43 PM, Zhongxing Xu <xuzhongxing at gmail.com> wrote:
> Is this the rule:
> - if the bitwidth of E2 is the same as the pointer, do the arithmetic.
> - if the bitwidth of E2 is different from the pointer, trunc or ext it to
> the same width of the pointer. Signed-ness affects the ext operation. Then
> do the arithmetic.
The rule is conceptually the following: "Do the arithmetic exactly; if
there's overflow, the result is undefined."
Your rules are equivalent for the defined cases, though.
-Eli
More information about the cfe-commits
mailing list