Rosetta Code:Village Pump/C++ edits: Difference between revisions

no edit summary
(In favor of malloc? Not likely.)
No edit summary
 
Line 1:
{{Vptopic
|topic=C++ edits
|summary=Relating to some edits of [[C++]] examples.
}}
Would someone who knows C++ better than I do please review the statements made today (2009-08-07) by [[Special:Contributions/86.199.73.222|86.199.73.222]], particularly [http://rosettacode.org/mw/index.php?title=Creating_an_Array&diff=57404&oldid=prev Creating an Array] and [http://rosettacode.org/mw/index.php?title=User_Input_-_text&diff=57403&oldid=prev User Input - text]? (Those I couldn't figure out what to do with. I've made some followup changes to the other pages; please review those as well.) --[[User:Kevin Reid|Kevin Reid]] 12:08, 7 August 2009 (UTC)
 
Line 8 ⟶ 12:
::: Of course there are no clues about a deprecation of the new operator to (m)allocate, around here and there, or I am not able to seek at all. --[[User:ShinTakezou|ShinTakezou]] 22:00, 7 August 2009 (UTC)
:::: ''''new'''' is preferred over malloc in all cases I'm familiar with. When used on a type with a constructor, it runs the constructor. When used on a type where the '''new''' operator is overloaded, it runs the overload. malloc() isn't so easy to hook into. --[[User:Short Circuit|Short Circuit]] 05:19, 8 August 2009 (UTC)
::::: In fact, <code>malloc()</code> is almost certainly the library call that sits ''underneath'' all forms of <code>new</code>, though the latter is preferred because it is type aware (and <code>std::vector</code> is often a better choice in practice AIUI). Still, all these things have their place. –[[User:Dkf|Donal Fellows]] 11:23, 16 November 2010 (UTC)
Anonymous user