OSNews article about C++09 degenerates into C++ vs. D discussion
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Mon Nov 20 08:07:39 PST 2006
Don Clugston wrote:
> Walter Bright wrote:
>> Boris Kolar wrote:
>>> I don't understand why a good RIAA is not already a part of D. C++
>>> has it, so
>>> it obviously can be done. The new 'scoped' keyword is insufficient
>>> for me,
>>> because I'd like to make all my classes scoped. I can usually develop
>>> 99% of my C++ code without a single 'new' or 'malloc'. Most of my
>>> classes
>>> are small (average ~2 fields and ~4 methods) and only used locally,
>>> so I'm
>>> really angry when I think about negative performance impact they will
>>> have
>>> in D simply because a decent RIAA is missing.
>>
>> Have you considered using structs instead of classes? They are
>> allocated on the stack.
>
> Can you do RAII with them?
> I thought that a struct cannot have a destructor, but reading the spec
> again I notice there's an entry for StructAllocator and
> StructDeallocator, but no indication of how to use it.
They are the same as class allocators and deallocators (which are not
*ctors):
http://www.digitalmars.com/d/class.html#allocators
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list