[cfe-dev] libcxx: Platform independent printing using format constants
Richard Smith
richard at metafoo.co.uk
Wed Oct 10 21:35:13 PDT 2012
On Wed, Oct 10, 2012 at 9:34 PM, Richard Smith <richard at metafoo.co.uk>wrote:
> libc++ does this to pick up the macro definitions:
>
> #include <inttypes.h>
>
> However, glibc's inttypes.h only provides them in C++ mode if
> _STDC_FORMAT_MACROS is defined, and libc++ doesn't define it.
>
Sorry, needs more underscore: __STDC_FORMAT_MACROS.
> On Wed, Oct 10, 2012 at 12:53 PM, Daniel Hofmann <daniel at trvx.org> wrote:
>
>> 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?
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121010/3d27fb75/attachment.html>
More information about the cfe-dev
mailing list