Re: log+sprintf in one

From: George (greerga@MIAVX1.ACS.MUOHIO.EDU)
Date: 07/15/97


On Tue, 15 Jul 1997, Akuma/Chris Baggett/DOOMer wrote:

>I don't know if that post was thanks to my sending them
>the sprintf() codes or not, (because i don't really know) but
>thanks to that snippet,
>I'm now getting stuff like the following
>
>Compiling comm.c
>comm.c: In function `main':
>comm.c:161: warning: unused variable `buf'
>comm.c: In function `record_usage':
>comm.c:849: warning: unused variable `buf'

Easy :) You don't need them anymore.
In stock circle it is common to use

function ()
{
  char buf[some_number];

  sprintf(buf...);
  log(buf);
}

This avoids overwriting the global buffers which may contain something
important.  With the sprintf+log function you no longer need the char buf[]
at the top of the function because you no longer to a sprintf() to a
temporary variable.

In a nutshell, delete those variables from the functions and save yourself
some memory and time allocating them. (albeit not so large)

-George


      +-----------------------------------------------------------+
      | Ensure that you have read the CircleMUD Mailing List FAQ: |
      |   http://cspo.queensu.ca/~fletcher/Circle/list-faq.html   |
      +-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST