From owner-freebsd-current@FreeBSD.ORG Sat Dec 17 10:28:39 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E728016A41F for ; Sat, 17 Dec 2005 10:28:39 +0000 (GMT) (envelope-from b.candler@pobox.com) Received: from thorn.pobox.com (thorn.pobox.com [208.210.124.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A56743D45 for ; Sat, 17 Dec 2005 10:28:39 +0000 (GMT) (envelope-from b.candler@pobox.com) Received: from thorn (localhost [127.0.0.1]) by thorn.pobox.com (Postfix) with ESMTP id 14AAE9D; Sat, 17 Dec 2005 05:29:00 -0500 (EST) Received: from mappit.local.linnet.org (212-74-113-67.static.dsl.as9105.com [212.74.113.67]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by thorn.sasl.smtp.pobox.com (Postfix) with ESMTP id AF0D62515; Sat, 17 Dec 2005 05:28:58 -0500 (EST) Received: from lists by mappit.local.linnet.org with local (Exim 4.60 (FreeBSD)) (envelope-from ) id 1EnZIp-0008ew-L5; Sat, 17 Dec 2005 10:28:35 +0000 Date: Sat, 17 Dec 2005 10:28:35 +0000 From: Brian Candler To: Poul-Henning Kamp Message-ID: <20051217102835.GC33190@uk.tiscali.com> References: <200512161856.jBGIudig093608@repoman.freebsd.org> <8509.1134766863@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8509.1134766863@critter.freebsd.dk> User-Agent: Mutt/1.4.2.1i Cc: current@freebsd.org Subject: Re: About extensible prinf(3), a slightly long X-mas card X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2005 10:28:40 -0000 On Fri, Dec 16, 2005 at 10:01:03PM +0100, Poul-Henning Kamp wrote: > Until somebody specifically ask for it (with a global variable or an > environment variable) or registers an extension, we keep running on > our good old fast spaghetti vprintf, but once extensibility is called > for, we switch to my code. Perhaps the semantics of this extended printf() are so far divorced from the standard one that you might as well just call it something else? e.g. ext_printf() or whatever. I can see two advantages to this approach: (1) you don't take a big performance hit on all your other printf() calls just because you used an extended format once in your code. (2) clear marking of non-portable code: you are not tempted to use non-standard features in a call to regular printf(), and end up with a program which compiles happily on any other platform but dumps core when run. In fact, why not stick it in a completely separate library altogether, rather than libc? That would greatly *assist* portability, since you could simply build this library on other targets. In this case it would be OK to call it printf(), as long as you don't mind the possible confusion and the requirement to do your linking in the correct order. > Obviously, such extensions are not condoned by style(9) but probably more > damning, GCC's printf format checker knows nothing about them, so it will > take a fit if you use them. > > For these reasons, and for general reasons of sanity, printf format > extensions should _not_ be added to FreeBSD programs at this time, if ever. Sounds to me like another good reason for calling the function something else, and/or putting it in a separate library. Regards, Brian.