Date: Wed, 12 Nov 1997 09:58:14 +0100 (MET) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: hackers@freebsd.org Subject: A stylistic question... Message-ID: <199711120858.JAA06510@labinfo.iet.unipi.it>
next in thread | raw e-mail | index | archive | help
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/ _____________________________|______________________________________
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711120858.JAA06510>