home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!howland.reston.ans.net!sol.ctr.columbia.edu!news.columbia.edu!cunixa.cc.columbia.edu!ae2
- From: ae2@cunixa.cc.columbia.edu (Amiran Eliashvili)
- Subject: using new
- Message-ID: <1993Jan8.171950.22884@news.columbia.edu>
- Sender: usenet@news.columbia.edu (The Network News)
- Nntp-Posting-Host: cunixa.cc.columbia.edu
- Reply-To: ae2@cunixa.cc.columbia.edu (Amiran Eliashvili)
- Organization: Columbia University
- Date: Fri, 8 Jan 1993 17:19:50 GMT
- Lines: 27
-
-
- Hi folks:
-
- I am in the process of porting a C program into C++ and
- learning a lot about C++. I am trying to find an equivalent C++
- construct for the following malloc command:
-
-
- ptr = (TypeCast *) malloc( LENGTH(n));
-
- where Length(n) is a macro that will return the n times of the
- desired object size. I have tried the following statement using new
- but for no avail:
-
-
- ptr = (TypeCast *) new char(LENGTH(n));
-
-
- The statement with new operator does not deliver exactly what the
- malloc does. Any suggestions how to use new to get the same 'effect' as what the malloc does in statement a. Thanks much.
-
-
- Please reply to :
-
- ae2@cunixa.cc.columbia.edu
-
- /amiran
-