Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 1997 15:16:57 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        adrian@virginia.edu
Cc:        hackers@freebsd.org
Subject:   Re: A stylistic question...
Message-ID:  <199711121416.PAA07129@labinfo.iet.unipi.it>
In-Reply-To: <Pine.SUN.3.90.971112090720.11574B-100000@stretch.cs.Virginia.edu> from "Adrian T. Filipi-Martin" at Nov 12, 97 09:16:39 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > 
> >     usage()
> >     {
> > 	printf( "%s", "bla bla bla...\n"
> > 		"bla bla bla...\n"
> > 		...
> > 		"bla bla bla...\n");
> >     }
...
> > Any reason not to use the second method ?
> 
> 	Not really.  It will compile into slightly smaller code and it
> will have better runtime performance since there will only one function
> call to printf().  
> 
> 	Why do yo feel that you need the "%s" though?  Just make the
> "blah..." your format string.  The parsing of the format string is pretty
> efficient.  It reads a char and then switch()'s on it to what to do. 

the "%s" was added on the fly while composing the message and not
knowing the details of format string parsing. After your clarification,
then the only possible usefulness is that one must not worry to
escape % chars ... a very weak motivation indeed.

	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?199711121416.PAA07129>