Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Mar 2009 08:49:59 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        Daniel Eischen <deischen@freebsd.org>, FreeBSD Arch <arch@freebsd.org>, Tim Kientzle <kientzle@freebsd.org>, Marcel Moolenaar <xcllnt@mac.com>
Subject:   Re: On errno
Message-ID:  <20090331064959.GA3516@onelab2.iet.unipi.it>
In-Reply-To: <95823.1238476941@critter.freebsd.dk>
References:  <49D1492C.5050101@freebsd.org> <95823.1238476941@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 31, 2009 at 05:22:21AM +0000, Poul-Henning Kamp wrote:
> In message <49D1492C.5050101@freebsd.org>, Tim Kientzle writes:
> 
> >> The probelm with an integer is that you cannot give details
> >> like:
> >> 	"partition 3 overlaps bootcode"
> >> without precreating the N^2 possible messages of that kind.
> >
> >The standard solution if you need variable parameters,
> >of course, is to pass the parameters back:
> >    int code: EPARTITIONOVERLAPSBOOTCODE
> >    char *default_text: "partition %1d overlaps bootcode"
> >    arg1: 3
> 
> And the "standard" solution is stupid and useless, because more
> often than not, some language, typically french, will want the
> arguments in the opposite order...

we are probably digressing but printf in glibc has specifiers to
indicate which argument you want to use for each format.

http://www.gnu.org/software/hello/manual/libc/Output-Conversion-Syntax.html

I suppose this takes an extra pass over the format string to collect
the proper type info for all arguments, so it is not
not a dramatic change in the implementation of *printf.

	cheers
	luigi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090331064959.GA3516>