Re: print 64bit-integer



Chris McDonald said:

Richard Heathfield <rjh@xxxxxxxxxxxxxxx> writes:

I'm not convinced about the "portable"! :-) Nor am I convinced of
the existence of a PRId64 modifier, but this may simply be because
I have paid little attention to C99. I have taken a brief look at
what the Standard has to say on the matter, but alas, I remain
unconvinced. Can you convince me that PRId64 (a) exists at all,
and (b) is /required/ to exist?


An *existence* proof is that it exists in gcc 3.2.2 (and probably
beyond),
certainly in gcc 4.0.1 on OS-X (you may choose to just believe me
on that).

Um, sorry. I meant an existence proof based on the Standard - i.e. a
demonstration that the Standard specifically caters for an
implementation creating such a macro (along the same lines as the
Standard catering for an implementation providing uint24_t without
requiring it to do so). Having said that, however, see below!

I believe that this makes it widely, though not universally,
portable.

No, I can't interpret Sect 7.8.1 to read that it /must/ exist.

Neither can I. (So much for "portable".) But re-reading that section
more carefully, I belatedly realise that the Standard does say that
N is to be replaced by a type width, so yes, at least I can now
agree that PRId64 /can/ exist.

For maximum portability, however, it should be avoided.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: Successor Axiom: on what grounds TF?
    ... being a natural number and the existence of n+1. ... either the Successor Axiom or the alternative. ... By the way I'm worried about your appendage of "in standard ... is not standard mathematics is irrelevant, ...
    (sci.logic)
  • Re: Cantor Confusion
    ... You should be familiar with this from of existence. ... that I've seen in any math book I've ever read. ... mean using standard mathematics. ... Existence proven but construction or definition ...
    (sci.math)
  • Re: Metamathematically True or False?
    ... >> Rupert wrote: ... > Existence of the language seems to me to be a pretty uncontentious sort ... Perhaps you're talking about existence of the standard ...
    (sci.logic)
  • Re: C89, size_t, and long
    ... a quiet change in the C99 Standard. ... library's existence somehow made me a villain. ... Another part is calling the library developers incompetent. ... the reason for you not understanding the lines either. ...
    (comp.lang.c)
  • Re: Successor Axiom: on what grounds TF?
    ... > being a natural number and the existence of n+1. ... > standard reasoning why one cannot prove the existence of God by the ... > either the Successor Axiom or the alternative. ... > is not standard mathematics is irrelevant, ...
    (sci.logic)