thanks. the count was off. the array gets deleted, but I could shift that over to a real array rather than on the heap, might help somewhat.
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: John Matthews To: [email protected] Sent: Tuesday, April 21, 2009 10:57 PM Subject: [c-prog] Re: server code help --- In [email protected], "Tyler Littlefield" <ty...@...> wrote: > > Server::~Server() > { > if (users.size() ) > { > unsigned int count=0; > for ( count=0;count< ( users.size() +1 );count++ ) > { > delete users[count]; > } Haven't examined it in detail (C++ isn't my thing) but can I just check that the users.size()+1 is OK? You know - if you have 10 items in an array they are indexed 0..9. Also, (possible) nitpick: > char* msg=new char[128]; > memset ( msg,0,128 ); > delete []msg; This might be standard C++, but why not just use a char array? Then you could use the safer: char msg[128]; memset(msg, 0, sizeof msg); and no need to remember to delete it. Alternatively, if you're going to use dynamic allocation, perhaps you could make it exactly the right size for the string you are constructing, instead of just picking a size you hope will be big enough (or perhaps 128 is always big enough - sorry, don't know). John [Non-text portions of this message have been removed]
