You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Justin Erenkrantz <je...@ebuilt.com> on 2001/04/22 09:14:30 UTC

Solaris and printf of 64bit values...

Solaris doesn't support "qd" in printf format strings for long long.  
All of the other platforms I am aware of also support "lld" (FreeBSD 
and Linux) - it is possible that "qd" is still the only option for 
true 4.4BSD kernels (qd originated there).  OS-dependent flags would 
have to be added for those platforms.  

Recent man pages of Linux call "qd" deprecated and recommend "lld" 
instead.  FreeBSD's man pages don't mention "lld" explictly, but
looking at libc/stdio/vfprintf.c from FreeBSD-4.2 shows it has support
for "lld" support in it.

It looks like whichever compiler has longlong uses "qd" - is this
Win32, by any chance?  Or, should this be switched to "lld" as well?
-- justin

Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.290
diff -u -r1.290 configure.in
--- configure.in	2001/04/12 13:05:38	1.290
+++ configure.in	2001/04/22 06:58:10
@@ -703,7 +703,7 @@
 elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
     off_t_fmt='#define APR_OFF_T_FMT "ld"'
 elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
-    off_t_fmt='#define APR_OFF_T_FMT "qd"'
+    off_t_fmt='#define APR_OFF_T_FMT "lld"'
 else
     off_t_fmt='#error Can not determine the proper size for off_t'
 fi
@@ -715,7 +715,7 @@
 elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
     os_proc_t_fmt='#define APR_OS_PROC_T_FMT "ld"'
 elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then
-    os_proc_t_fmt='#define APR_OS_PROC_T_FMT "qd"'
+    os_proc_t_fmt='#define APR_OS_PROC_T_FMT "lld"'
 else
     os_proc_t_fmt='#error Can not determine the proper size for pid_t'
 fi


Re: Solaris and printf of 64bit values...

Posted by Justin Erenkrantz <je...@ebuilt.com>.
Oh, no.  vsprintf.c only takes in single character formats.  This
patch breaks a lot of stuff in httpd.  Consider it retracted for now.

Is everything that is a APR_<FOO>_T_FMT ONLY going to be used with
APR's apr_snprintf.c?  Or, should we remain compatible with the 
underlying printf() calls on each platform?

I was using this patch in a standalone APR program which used the
native system calls to print to stdout, so I didn't see this until I 
tried to compile httpd.

I bet APR_INT64_T_FMT is bogus in httpd too.

Yummy.  -- justin

On Sun, Apr 22, 2001 at 12:14:30AM -0700, Justin Erenkrantz wrote:
> Solaris doesn't support "qd" in printf format strings for long long.  
> All of the other platforms I am aware of also support "lld" (FreeBSD 
> and Linux) - it is possible that "qd" is still the only option for 
> true 4.4BSD kernels (qd originated there).  OS-dependent flags would 
> have to be added for those platforms.  
> 
> Recent man pages of Linux call "qd" deprecated and recommend "lld" 
> instead.  FreeBSD's man pages don't mention "lld" explictly, but
> looking at libc/stdio/vfprintf.c from FreeBSD-4.2 shows it has support
> for "lld" support in it.
> 
> It looks like whichever compiler has longlong uses "qd" - is this
> Win32, by any chance?  Or, should this be switched to "lld" as well?
> -- justin
> 
> Index: configure.in
> ===================================================================
> RCS file: /home/cvspublic/apr/configure.in,v
> retrieving revision 1.290
> diff -u -r1.290 configure.in
> --- configure.in	2001/04/12 13:05:38	1.290
> +++ configure.in	2001/04/22 06:58:10
> @@ -703,7 +703,7 @@
>  elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
>      off_t_fmt='#define APR_OFF_T_FMT "ld"'
>  elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
> -    off_t_fmt='#define APR_OFF_T_FMT "qd"'
> +    off_t_fmt='#define APR_OFF_T_FMT "lld"'
>  else
>      off_t_fmt='#error Can not determine the proper size for off_t'
>  fi
> @@ -715,7 +715,7 @@
>  elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
>      os_proc_t_fmt='#define APR_OS_PROC_T_FMT "ld"'
>  elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then
> -    os_proc_t_fmt='#define APR_OS_PROC_T_FMT "qd"'
> +    os_proc_t_fmt='#define APR_OS_PROC_T_FMT "lld"'
>  else
>      os_proc_t_fmt='#error Can not determine the proper size for pid_t'
>  fi