Re: Problems printing 64-bit integers i glib 2.4.8



Owen Taylor wrote:
On Tue, 2004-12-14 at 15:28 +0100, Egon Andersen wrote:

Hi,

I've experienced problems with g_strdup_printf() in glib 2.4.8 when I try to print 64-bit integers on Windows.

I have the following line in my code:

intmax_t se_nr; /* ISO-C99 */
...
se_nr = ... /* e.g. 12345678 */
...
string = g_strdup_printf("%08"PRIdMAX"admin", se_nr);

                                ^^^^^^^
What's that?


That is a macro defined in ISO-C99 in inttypes.h which expands to whatever is the format used for the max integer type defined. And is matching intmax_t which is the max integer type defined.
On Windows this is 64-bit integers.


If you use gint64 and G_GINT64_FORMAT does it work?

No - same result :-(
Both macros (PRIdMAX and G_GINT64_FORMAT) expands to the same I64i on Windows.

A little additional info! A standard snprintf() is working as expected!

Best regards
Egon Andersen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]