Thread overview
Re: is this the expected output
Dec 23, 2010
g g
Dec 23, 2010
spir
Dec 23, 2010
Dmitry Olshansky
December 23, 2010
Thanks for the answers
what I did is this ( i feel that it is quite clumsy):

       Node* x = cast(Node*) (GC.malloc(Node.sizeof));
        *x = xa;
        x.up = curnode;
        ...
December 23, 2010
On Wed, 22 Dec 2010 19:40:16 -0500
g g <htpp@www.com> wrote:

> Thanks for the answers
> what I did is this ( i feel that it is quite clumsy):
> 
>        Node* x = cast(Node*) (GC.malloc(Node.sizeof));
>         *x = xa;
>         x.up = curnode;
>         ...

This is not that clumsy (except for you naming!). You have to allocate distinct memory cells for distinct programming elements that represent distinct entities in your (mental) modell, haven't you? D provides adequate features that allow you thinking thinking at a higher-level. But if you want to play at a lower-level, you'll need to juggle with pointer detail issues ;-)

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

December 23, 2010
On 23.12.2010 3:40, g g wrote:
> Thanks for the answers
> what I did is this ( i feel that it is quite clumsy):
>
>         Node* x = cast(Node*) (GC.malloc(Node.sizeof));
>          *x = xa;
>          x.up = curnode;
>          ...
which could be improved:
Node* x = new Node(...);//paste your constructor args in place of ...  if Node has a constructor, or just
Node* x = new Node;// if no constructors

-- 
Dmitry Olshansky