J
Jeff
Hi,
i'm trying to use new/delete in C++ instead of malloc/free.
I have this :
int g_TTable_size=130000; // for example
struct hash_t
{
int depth;
int flags;
int eval;
};
And this works fine :
hash_t *pt_htable = (hash_t *) malloc (g_TTable_size*sizeof(hash_t));
if(pt_htable!=NULL) {free(pt_htable);}
But this not :-((
hash_t *pt_htable = (hash_t *) new char[g_TTable_size*sizeof(hash_t)];
neither :
hash_t *pt_htable = (hash_t *) new hash_t[g_TTable_size];
And this may be ok, i don't know yet :
if(pt_htable!=NULL) {delete pt_htable;}
What am i doing wrong ?
Thanks for your help.
i'm trying to use new/delete in C++ instead of malloc/free.
I have this :
int g_TTable_size=130000; // for example
struct hash_t
{
int depth;
int flags;
int eval;
};
And this works fine :
hash_t *pt_htable = (hash_t *) malloc (g_TTable_size*sizeof(hash_t));
if(pt_htable!=NULL) {free(pt_htable);}
But this not :-((
hash_t *pt_htable = (hash_t *) new char[g_TTable_size*sizeof(hash_t)];
neither :
hash_t *pt_htable = (hash_t *) new hash_t[g_TTable_size];
And this may be ok, i don't know yet :
if(pt_htable!=NULL) {delete pt_htable;}
What am i doing wrong ?
Thanks for your help.