From owner-freebsd-standards Tue Feb 26 8:48:25 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mail-blue.research.att.com (mail-blue.research.att.com [135.207.30.102]) by hub.freebsd.org (Postfix) with ESMTP id 10BD937B430 for ; Tue, 26 Feb 2002 08:48:13 -0800 (PST) Received: from alliance.research.att.com (alliance.research.att.com [135.207.26.26]) by mail-blue.research.att.com (Postfix) with ESMTP id 6D15D4CE33; Tue, 26 Feb 2002 11:48:12 -0500 (EST) Received: from windsor.research.att.com (windsor.research.att.com [135.207.26.46]) by alliance.research.att.com (8.8.7/8.8.7) with ESMTP id LAA13482; Tue, 26 Feb 2002 11:48:11 -0500 (EST) From: Bill Fenner Received: (from fenner@localhost) by windsor.research.att.com (8.8.8+Sun/8.8.5) id IAA20603; Tue, 26 Feb 2002 08:48:11 -0800 (PST) Message-Id: <200202261648.IAA20603@windsor.research.att.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII To: bde@zeta.org.au Subject: Re: scanf(3) patches for review Cc: standards@freebsd.org Date: Tue, 26 Feb 2002 08:48:10 -0800 Versions: dmail (solaris) 2.3/makemail 2.9b Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Better code would use a a specialized function for each result type and >not risk gratutous sign extension bugs for storing all the results in a >common type. I actually typedef'd a type to avoid all the prototype-free casts: typedef uintmax_t (*ccfn_t) (const char *, char **, int); The big if is almost there already (as you noted later), dealing with assigning back to the right vararg type. Strictly speaking, it's cheating for unsigned values, so a truly correct function would have to have the extra ifs for signed/unsigned anyway. At that point, putting the right conversion function instead of "res" would be trivial. >Strictly, uintmax_t is not suitable for storing pointers. I thought uintmax_t was the largest integer type, and uintptr_t was an integer type large enough to store a pointer -- so sizeof(uintmax_t) >= sizeof(uintptr_t). Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message