From Chris Downs · 1996-04-10 16:51 · #73681 in EMULATE
In reply to cchar.hpp by Darin McBride
EB> Also, although you didn't explicitly call it out, EB> you've eliminated the redundant "if (pchar == NULL) EB> delete[] pchar;" since delete[] is guaranteed to have EB> no effect if called with a NULL argument. DM> While delete is guaranteed this behaviour, I like to avoid it when I DM> can. While I'm not going to go on a tirade on this one <GRIN: Bob, DM> Fred>, I think that deleting already non-existant memory is 'bad'. I don't know about that... DM> By taking DM> this method, my code will be a little slower Actually, it would speed up your code. The implementation has to check for NULL and if your compiler can't generate extra fast code for if (!ptr) delete ptr, then your compiler is pretty poor. So moving the check for null out of the called proc would save you the function call overhead. If a lot of your memory deallocation involves NULL pointers, then it may make sense to go after the extra speed at the cost of extra code. ___ Blue Wave/QWK v2.20 [NR] --- WILDMAIL!/WC v4.12 * Origin: (1:100/4.0)