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 - Me@Null.net | Genius may have its limitations, but stupidity http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST