Languages for servers (Go, D, and more)

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 8 07:24:09 PDT 2014


On Tuesday, 8 July 2014 at 02:31:50 UTC, Átila Neves wrote:
> On Monday, 7 July 2014 at 18:15:32 UTC, Sean Kelly wrote:
>>
>> With asynchronous event-driven code (ie. server code), I don't
>> see any way to avoid all use of new / delete.
>
> std::make_unique and std::make_shared are what you're 
> "supposed" to use. The new and delete operators are (usually) 
> for library writers.
> Even before C++11, using delete was frowned upon but necessary 
> with containers of pointers due to std::auto_ptr not helping. 
> Well, that and the lack of move semantics.

But you're ultimately passing something as a void* to a library 
call and receiving it later as the context for a callback.  That 
value has to live on the heap.


More information about the Digitalmars-d mailing list