--- 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