Re: Poll: global buffers

From: Mike Stilson (
Date: 07/21/01

On Fri, Jul 20, 2001 at 08:39:22PM -0700, George Greer came up with this idea:

> So far I'm hearing for/against from various people but not a lot of "why"
> yet.

One quick of a problem with the "ease of use"..

void bar(char_data *ch, char *buf)
        sprintf(lbuf,"Bar entered.\r\n");

void foo(char_data *ch)
        sprintf(buf,"Foo entered.\r\n");
        bar(ch, buf);
        send_to_char(buf, ch);

Ok, now imagine these to be in something a little more complex.

And there's also the annoying problem of doing something like
defining lbuf locally then forgetting the 'l' when passing it

Yes, they both fall under the area of laziness or coding errors,
but they both can be a little harder to track down.   Severely
munging them could even run into trashing something else.  Say,
using buf in some implementation of ascii pfiles to store something
about the char to be written to disk, then calling something else
to check it and overwriting it accidentally there.

I agree with the easiness aspect, it is easier, but with computers
having MANY times more memory these days, allocating a quick 1k
here or there isn't much of an issue.

(Not to mention, just think of the fun if you should convert to
using asprintf and use buf in that call?)


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST