[haiku-development] Re: complex constructors in kernel (following #4782)

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 27 Oct 2009 13:25:32 +0100

Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> It slowly dawns on me, what you're trying to say. You want to 
> introduce 
> some means to mark certain static constructors so that they aren't 
> invoked 
> automatically. I find that unnecessarily complicated, though.

I actually completely misunderstood your comments to bug #4782, and 
thought you wanted to have some automatic way to evaluate the 
complexity of a constructor.
And this was the more conservative counter proposal that would give you 
more control, but still allowed for some automatism :-)

> I would 
> rather call all constructors and adjust the code that has 
> constructors that 
> shouldn't be called that early. Either by moving code from the 
> constructor 
> to an explicit Init() method or by constructing the object explicitly 
> in a 
> static buffer like:
> 
>       static char sObjectBuffer[sizeof(Foo)];
>       static Foo* sObject;
>       ...
>       sObject = new(sObjectBuffer) Foo;

That's indeed the solution I would prefer as well.

Bye,
   Axel.


Other related posts: