Re: [CODE] Crashing

From: George (greerga@CIRCLEMUD.ORG)
Date: 04/01/98

On Wed, 1 Apr 1998, Angus Mezick wrote:

>This type of error is what george's buffer system is great for catching.

And perhaps some day I'll finish the C++ version. :)

The buffers themselves work just fine, it's the global allocator that
isn't yet written.  So you can throw 'Buffer *buf(128);' in the function,
it'll just malloc() it's memory instead of pulling from the pool.

I've dropped the Buffer class objects in place of buf[128]'s and didn't
even notice the difference when it compiled and ran. (Which is good, you
don't want to have to change anything.)

It supports such common constructs as:
sprintf(buf, ...);
strcpy(buf, ...);
strcat(buf, ...);

all with bounds checking.  It also keeps the string length internally so
repeated calls to strlen on it don't actually have to count the whole
thing, unless it is called with the 'char *' conversion in which case it
has to recalculate it because you never know what happened to the string.

blah, maybe I'll work on it sometime soon, it even has a test suite. :)

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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