cvs.gedasymbols.org/archives/browse.cgi | search |
From: | rpolzer AT gmx DOT de |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Replacing malloc(size) with new and delete - is that possible |
Date: | Tue, 09 Mar 1999 07:56:51 GMT |
Organization: | Deja News - The Leader in Internet Discussion |
Lines: | 20 |
Message-ID: | <7c2k7v$p6h$1@nnrp1.dejanews.com> |
NNTP-Posting-Host: | 62.156.31.78 |
X-Article-Creation-Date: | Tue Mar 09 07:56:51 1999 GMT |
X-Http-User-Agent: | Mozilla/4.0 (compatible; MSIE 4.01; Windows 95; DT) |
X-Http-Proxy: | 1.1 x4.dejanews.com:80 (Squid/1.1.22) for client 62.156.31.78 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
I don't want to use malloc because it expands the EXE size by ca. 40 kB (mingw32). Can I do the following: (in C++) struct PACKET { // ... some data char P_DATA[0]; }; PACKET *p; p = (PACKET *) new char [i + sizeof(PACKET)]; //this should work But how to delete p? delete p; // memory leak? delete [] p; // does THAT work? delete [] (char *) p //or that? -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |