Subject: Re: [PATCH] Obey NO_C99_FORMAT in fast-import.c.

From: Simon 'corecode' Schubert <[email-masked]>
Date: Tue, 20 Feb 2007 13:57:16 +0100

Jason Riedy wrote:
> Define UM_FMT and UM10_FMT and use in place of %ju and %10ju,
> respectively.  Both format as unsigned long long, so this
> assumes the compiler supports long long.

So there are really systems which do not support the "j" (standardized) size modifier, but support "long long" (unstandardized) integers?  Oh my.

> +#if !defined(NO_C99_FORMAT)
> +#define UM_FMT "%ju"
> +#define UM10_FMT "%10ju"
> +#else
> +/* Assumes unsigned long long exists. */
> +#define UM_FMT "%llu"
> +#define UM10_FMT "%10llu"
> +#endif

I think this should read something like

#ifndef PRIuMAX
#define PRIuMAX		"llu"	/* Assumes unsigned long long exists */
#endif

After all, these macros are standardized (<inttypes.h>)

Hunks like this should of course read differently then:

> -		die("mark :%ju not declared", orig_idnum);
> +		die("mark :" UM_FMT " not declared", orig_idnum);

die("mark :%"PRIuMAX" not declared", orig_idnum);

> +		fprintf(stderr, "Alloc'd objects: " UM10_FMT "\n", alloc_count);

And then this UM10_FMT stunt isn't needed either:

fprintf(stderr, "Alloc'd objects: %10"PRIuMAX"\n", alloc_count);

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \