J
Jonathan Mcdougall
In a recent posting, my notation was corrected:
I would event say
tree rootNode;
tree subNode;
The struct qualifier is redundant.
There is a difference between these two : prootNode and psubNode are
pointers to heap-allocated objects and rootNode and subNode are objects
allocated on the stack. If you don't know the difference between them, you
should by a better book. The general practice is : if you don't need to
allocate objects on the heap, put them on the stack. It is faster, more
efficient (and all the good words like that) and easier to work with. No
news is good news.
Jonathan
struct tree rootNode;
struct tree subNode;
rootNode.child = &subNode;
subNode.parent = &rootNode;
I would event say
tree rootNode;
tree subNode;
The struct qualifier is redundant.
Is this due to some general C++ convension/practice or because its
compiler specific to use indirection? I've seen many compilers
understanding -> however.
There is a difference between these two : prootNode and psubNode are
pointers to heap-allocated objects and rootNode and subNode are objects
allocated on the stack. If you don't know the difference between them, you
should by a better book. The general practice is : if you don't need to
allocate objects on the heap, put them on the stack. It is faster, more
efficient (and all the good words like that) and easier to work with. No
news is good news.
Jonathan