[cfe-dev] libcxx: Platform independent printing using format constants

Daniel Hofmann daniel at trvx.org
Wed Oct 10 12:53:52 PDT 2012


Hi,

I'm currently porting a program from g++/libstdc++ to clang/libcxx and
was quite surprised that the platform independent printing using format
constants, e.g. PRId64, produces errors with libcxx.

A simple example which compiles fine w/o libcxx or g++
> #include <cstdio>
> #include <cinttypes>
> 
> int main() {
>   int64_t n = 1;
> 
>   printf("%" PRId64, n);
> }

w/ -stdlib=libcxx
> +7:14: error: expected ')'
>   printf("%" PRId64, n);
>              ^
> +7:9: note: to match this '('
>   printf("%" PRId64, n);
>         ^

Although the cinttypes header comments lists them
> Macros:
>     ...
>     PRId64


So, what am I missing here? Is this not yet supported? How am I supposed
to handle this?



More information about the cfe-dev mailing list