Date: Wed, 12 Nov 1997 07:21:12 -0500 From: Jerry Hicks <wghhicks@ix.netcom.com> To: hackers@FreeBSD.ORG Subject: Re: A stylistic question... Message-ID: <34699F38.330982A9@ix.netcom.com> References: <199711120858.JAA06510@labinfo.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo wrote:
> 
> 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/
> _____________________________|______________________________________
Actually, the second form probably lends itself to internationalization
better.
J. Hicks
jerry_hicks@bigfoot.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34699F38.330982A9>
