Auto syntax revisited

Fredrik Olsson peylow at gmail.com
Tue Feb 21 13:31:05 PST 2006


Ivan Senji skrev:
> Fredrik Olsson wrote:
> 
>> Ivan Senji skrev:
>> <snip>
>> // Object could be on stack, created from class, scope exit destroys
> 
> 
> Everything sounds cool, but that *could* part troubles me :)
> It should either mean stack, or heap, or have a choise over that.
> 
'Could' always sounds scary, but then again we can not decide if the 
compiler should inline functions, they *could* all be inlined if the 
compiler so chooses. The point here is that this case is the most likely 
for the compiler to be able to do fancy stuff too, so why restrict it? I 
am sure that 9 of 10 implementations of D would use the stack.

But what if another implementation for some reason or another do not 
want to go over the trouble to implement stack allocation? Or maybe even 
finds an even better way to do it, whatever that might be. The important 
point here is (if I have not completely misunderstood the intentions) to 
have an object that is destroyed when out of scope with as little 
overhead as possible. Using the stack for that purpose is good, but 
forcing, why?

// Fredrik



More information about the Digitalmars-d mailing list