From: Rudolf Polzer Newsgroups: comp.os.msdos.djgpp Subject: Re: Replacing malloc(size) with new and delete - is that possible Date: Mon, 15 Mar 1999 17:31:11 GMT Organization: Deja News - The Leader in Internet Discussion Lines: 26 Message-ID: <7cjg4v$556$1@nnrp1.dejanews.com> References: NNTP-Posting-Host: 193.227.244.61 X-Article-Creation-Date: Mon Mar 15 17:31:11 1999 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98) X-Http-Proxy: 1.1 x16.dejanews.com:80 (Squid/1.1.22) for client 193.227.244.61 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article , djgpp AT delorie DOT com wrote: > rpolzer AT gmx DOT de asked: > > > Can I do the following: (in C++) > > > > struct PACKET { > > // ... some data > > char P_DATA[0]; > ^^^ > > }; > > Typo, I guess. (By the way, if you want to use C++ anyway, > the string class may be helpful.) > No, it was just that I DIDN'T KNOW how big P_DATA will be. The packets should be sent through TCP/IP and contained some other fields. OK, I also can use classes, but I would have to copy P_DATA and PACKET into a new array which is much overhead. I did this very often in Turbo Pascal with switched-off range checking. I wanted to know if a p = (...) new char[n] could replace malloc and a delete [] (char *) p could replace free. But, the exe file grew if using this, so that the answer is now irrelevant to me. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own