[llvm-commits] [PATCH] Compress Repeated Byte Output

David A. Greene greened at obbligato.org
Wed Aug 31 09:19:03 PDT 2011


Chris Lattner <clattner at apple.com> writes:

> +    for (int i = 1, e = CA->getNumOperands(); i != e; ++i) {
>
> Please declare 'i' as 'unsigned' instead of 'int'.

I'm not objecting to this, but rather am curious.

Typing loop counters as unsigned can do all sorts of horrible things to
analysis and optimization due to wraparound requirements.  I've got into
the habit of always typing loop counters as signed to avoid these
issues.  Is there a specific reason to prefer unsigned?

                               -Dave



More information about the llvm-commits mailing list