Re: Long long int's and sprintf

From: Mike Stilson (
Date: 06/16/01

On Sat, Jun 16, 2001 at 10:22:25PM -0700, Peter Ajamian came up with this idea:
> Mike Stilson wrote:
>> [snip some compiler warnings.
> I wanted to see where those warnings came from so here's the details from
> my system:
> $rpm -qf /usr/include/stdlib.h
> glibc-devel-2.2-12

There's the difference.  Still have an older glibc here.

$ rpm -qf /usr/include/stdlibh

>>From /usr/include/stdlib.h:
> #if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC)
> /* These functions will part of the standard C library in ISO C99.  */

Change all instances of C99 to C9X and they're identical.  I tried the
defines.  Didn't help, but it didn't matter anyway.  It was just a
compiler warning solved by adding my own proto (cut/paste from that file)

> So in order for it to work, it would appear that you need to add a
> #define for __USE_ISOC99 or for both __GNUC__ and __USE_MISC before the
> #include <stdlib.h>.  Note that you can also use strtouq() which is an
> older BSD version and is functionally identical to strtoull() (I would
> recommend strtoull() over strtouq() but you may be on an older non C99
> compiler which does have support for strtouq() in which case you can
> either use that directly or create a macro for strtoull()).

Problem is upgrading glibc. (about 50-60 dependencies break with upgrade)
Not feeling like ripping my entire system to shreds (I just finally got
the other 4 boxes working nicely with this) at the moment, I'm suffering
through an older libc.  One of these days.... who knows what affects
spare time can cause.  Last 3 day weekend I switched everything to
reiserfs.  Next one, who knows.

It does have strtoull defined in there though, and it does link, just
requires me to fill in the ptr & base for it to work right.
in other words, can't just do:
unsigned long long int var; var=strtoull(from);
have to do
unsigned long long int var; var=strtoull(from, NULL, 10);

Not sure why, I'll look into it today.

Either that or I'll actually wake up early and upgrade all that stuff.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST