[llvm-commits] [llvm] r50946 - /llvm/trunk/include/llvm/Instructions.h

Bill Wendling isanbard at gmail.com
Sat May 10 12:55:26 PDT 2008


On May 10, 2008, at 10:57 AM, Gabor Greif wrote:

> +      NumOperands = (unsigned)(uintptr_t)((Use*)this - OperandList);
>
> Hi Bill,
>
> wouldn't
>
> +      NumOperands = unsigned((Use*)this - OperandList);
>
> do the job?
>
That would probably be okay. :-) I just wanted to make sure that the  
compiler wouldn't yell because of the cast from a pointer to (smaller)  
integral value.

> PS: Sorry for these warnings, neither my
> solaris gcc 3.4.6, nor Apple gcc 4.0.1
> has shown them.
>
No worries. I don't think that those compilers would have. You needed  
to compile an application with "-Wshorten-64-to-32 -Werror" in order  
to get the errors.

I think you need to use "uintptr_t" instead of "unsigned" for the  
placement-new in User.h.

-bw




More information about the llvm-commits mailing list