Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11763

Re: only memory allocationj in new

From jt@toerring.de (Jens Thoms Toerring)
Newsgroups comp.lang.c++
Subject Re: only memory allocationj in new
Date 2011-11-23 22:29 +0000
Organization Freie Universitaet Berlin
Message-ID <9j5aenFmo6U1@mid.uni-berlin.de> (permalink)
References <20250790.637.1321992864775.JavaMail.geo-discussion-forums@prdy11>

Show all headers | View raw


asit <lipun4u@gmail.com> wrote:
> new does the following two things.
> 1>allocate memory
> 2>calls constructor

> can I avoid the 2nd step ?

What about using malloc()? Seems to be considered as "bad"
when it comes to C++, but that's the function that just
allocates memory and nothing else. Of course, when you
don't need the memory anymore you instead of using delete
you must to call free() (which then, also of course, does
not call the destructor of your object).

                           Regards, Jens
-- 
  \   Jens Thoms Toerring  ___      jt@toerring.de
   \__________________________      http://toerring.de

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

only memory allocationj in new asit <lipun4u@gmail.com> - 2011-11-22 12:14 -0800
  Re: only memory allocationj in new Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-22 15:37 -0500
  Re: only memory allocationj in new "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-22 21:38 +0100
  Re: only memory allocationj in new Goran <goran.pusic@gmail.com> - 2011-11-22 23:39 -0800
    Re: only memory allocationj in new Juha Nieminen <nospam@thanks.invalid> - 2011-11-23 09:17 +0000
      Re: only memory allocationj in new Robert Wessel <robertwessel2@yahoo.com> - 2011-11-23 04:09 -0600
      Re: only memory allocationj in new Goran <goran.pusic@gmail.com> - 2011-11-23 02:48 -0800
      Re: only memory allocationj in new Kevin McCarty <kmccarty@gmail.com> - 2011-11-23 08:20 -0800
  Re: only memory allocationj in new jgk@panix.com (Joe keane) - 2011-11-23 18:10 +0000
  Re: only memory allocationj in new jt@toerring.de (Jens Thoms Toerring) - 2011-11-23 22:29 +0000

csiph-web