From: mdw Date: Sat, 5 Mar 2005 16:45:23 +0000 (+0000) Subject: Correct misunderstanding of how inttypes.h printf format strings work. X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/commitdiff_plain/e8776ccd627d33fdbf0fc2746a2bfb62765c24a4 Correct misunderstanding of how inttypes.h printf format strings work. --- diff --git a/mptypes.c b/mptypes.c index 3502ba3..9796d5c 100644 --- a/mptypes.c +++ b/mptypes.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mptypes.c,v 1.5 2004/04/08 01:36:15 mdw Exp $ + * $Id$ * * Generate `mptypes.h' header file for current architecture * @@ -34,6 +34,7 @@ #include #if __STDC_VERSION__ >= 199900l # include +# include #endif /*----- Data types --------------------------------------------------------*/ @@ -60,10 +61,10 @@ # define P_UMAX PRIuMAX #elif defined(ULLONG_MAX) __extension__ typedef unsigned long long umax; -# define P_UMAX "%llu" +# define P_UMAX "llu" #else typedef unsigned long umax; -# define P_UMAX "%lu" +# define P_UMAX "lu" #endif /* --- Table of interesting types --- * @@ -175,11 +176,11 @@ int main(int argc, char *argv[]) printf("\ %stypedef %s mpw;\n\ #define MPW_BITS %u\n\ -#define MPW_MAX %s" P_UMAX "%s\n\ +#define MPW_MAX %s%" P_UMAX "%s\n\ \n\ %stypedef %s mpd;\n\ #define MPD_BITS %u\n\ -#define MPD_MAX %s" P_UMAX "%s\n\ +#define MPD_MAX %s%" P_UMAX "%s\n\ \n\ #endif\n\ ",