From owner-freebsd-hackers Wed Nov 12 02:22:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA22222 for hackers-outgoing; Wed, 12 Nov 1997 02:22:14 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id CAA22205 for ; Wed, 12 Nov 1997 02:22:09 -0800 (PST) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id JAA06510 for hackers@freebsd.org; Wed, 12 Nov 1997 09:58:14 +0100 From: Luigi Rizzo Message-Id: <199711120858.JAA06510@labinfo.iet.unipi.it> Subject: A stylistic question... To: hackers@freebsd.org Date: Wed, 12 Nov 1997 09:58:14 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk I have always wondered about this: most if not all programs, and some pieces of the kernel as well (e.g. userconfig.c) have a menu/usage function which is written like this: usage() { printf( "bla bla bla...\n" ); printf( "bla bla bla...\n" ); printf( "bla bla bla...\n" ); ... printf( "bla bla bla...\n" ); } instead of what in my opinion would be much better: usage() { printf( "%s", "bla bla bla...\n" "bla bla bla...\n" ... "bla bla bla...\n"); } yes the code savings are modest (5-10 bytes/call ? but in the kernel or boot blocks they still matter...) but at runtime the second approach is faster since the format string must be parsed only once and it is the shortest possible. Any reason not to use the second method ? Cheers Luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________