What can you "new"
Sean Kelly
sean at invisibleduck.org
Thu Mar 26 08:43:17 PDT 2009
grauzone wrote:
> Sean Kelly wrote:
>> Georg Wrede wrote:
>>>
>>> To do Systems Work on an embedded system, I'd like to see a D subset,
>>> without GC, and which would essentially be like C with classes. I've
>>> even toyed with the idea of having a D1toC translator for the job.
>>
>> With D2 you can drop in a different allocator to be used by the
>> runtime -- there's an example implementation that simply calls
>> malloc/free, for example. You'll leak memory if you perform string
>> concatenation or use the AA, but otherwise everything works fine.
>
> You forgot the array literals (which almost look like harmless,
> non-allocating array initializers), and the full closure delegates,
> where the compiler will randomly choose to allocate or not to allocate
> memory ("randomly" from the programmer's point of view). And of course
> most library functions.
The array literals should really be fixed :-p But you're right--I
forgot about closures. Library functions... that's at least something
easily addressable by the user. In all fairness, I agree that it isn't
terribly practical to forego a GC in D, but it is possible for a
sufficiently motivated user.
More information about the Digitalmars-d
mailing list