Developer to Developer warning


Subject: Developer to Developer warning
From: Thomas Fletcher (thomasf@qnx.com)
Date: Wed Oct 11 2000 - 15:29:56 CDT


All,

  Just wanted to pass this on since I've seen it in various
places in the abiword code and I just want to make sure that
everone understands this problem.

  Going through code I'm finding several instances of

XXX *var = new XXX[size];

then later we free it

delete var

THIS IS NOT GOOD! If you are allocating an array, then
you must de-allocate it as an array and use this syntax:

delete [] var

See Stroustrup 10.4.7 for more information. I'll patch
things up where I find them, but developers need to be
a little bit careful doing things like this.

Thomas
-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 2b25 : Wed Oct 11 2000 - 15:25:57 CDT