Re: Problems printing 64-bit integers i glib 2.4.8



On Tue, 2004-12-14 at 19:09 +0100, Egon Andersen wrote:
> 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.

Well, the C99 stuff isn't expected to work - g_strdup_printf() is
guaranteeing features that aren't present in the Windows C library
like %<n>$ argument reordering, so it's a separate codebase.

Test the GLib stuff with the current version of GLib, and if it 
still doesn't work, file a bug.

Regards,
						Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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