[LLVMdev] Say hi to VMKit: JVM/LLVM, CLI/LLVM

Török Edwin edwintorok at gmail.com
Wed Mar 26 12:23:47 PDT 2008


Nicolas Geoffray wrote:
> Very nice Torok! I applied most of the patch. A few comments:
>   

Thanks!

> 1) What is your jni.h file? I can't compile the Jni.cpp file with your 
> changes.
>   

Ouch, did they change 'const'-ness between gcj versions?
I was using gcj-4.2.3, and jni.h is from libgcj8-dev.

> 2) ISO C++ does not support %jd. x86_64 does not know about %lld?
>   

It does, but gcc gives a warning, if I use %lld I get a warning on
x86_64, if I %ld I get a warning on x86-32.
int64_t is long int on x86-64. However sizeof(long int) == sizeof(long
long int), so I don't know why gcc insists it is wrong.
I only found %jd which doesn't give warnings on either:

#include <stdio.h>
#include <stdint.h>
int main()
{
        int64_t x=0;
        printf("%ld",x);
        printf("%lld",x);
        printf("%jd",x);
        return 0;
}

$ gcc -Wall -O2 p.c
p.c: In function ‘main’:
p.c:7: warning: format ‘%lld’ expects type ‘long long int’, but argument
2 has type ‘int64_t’
$ gcc -Wall -O2 p.c -m32
p.c: In function ‘main’:
p.c:6: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has
type ‘int64_t’

Best regards,
--Edwin



More information about the llvm-dev mailing list