last day (18 days later) » 

20:21
1
A: Stack abstraction

forsvarirHeader guards As has been pointed out in previous reviews you aren't using header guards in your include files. This can cause problems, in addition to slowing down your compile time. static static static If you're not planning on exporting functions then you should be declaring them as stati...

In include files, I have function declaration and some system headers, which one should be guarded?
@overexchange typically, the entire contents of the header is contained in the guard.
From other technician, I learnt this regarding header guard
@overexchange It's strange to have a header guard that only guards system includes which is what you've go in your tree.h. I suspect if your #endif /*TREE_H*/ was on line 39 and you hadn't defined a separate TREE_OP guard, you wouldn't have got that comment.
##1) Line 39, you mean function declaration does not require header guard? ##2) One supplementary question, For rooted tree, I considered lcrs and multi-walk representation.For further coding, How to represent tree that has no root, shown here?
20:21
@overexchange I'm afraid I don't understand the question.
@forsvarir Hi
Line 39 is the line before function declarations.
Are you saying that header guard is not required for function declarations
?
I'm saying that I'd expect tree.h to look like this: pastebin.com/hd0NFpeZ
A single header guard that covers the entire header file, not separate guards for sections of the header.
ok
One last question
How to represent trees that do not have root?
I've never worked with a tree that doesn't have a root.
In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any acyclic connected graph is a tree. A forest is a disjoint union of trees. The various kinds of data structures referred to as trees in computer science have underlying graphs that are trees in graph theory, although such data structures are generally rooted trees. A rooted tree may be directed, called a directed rooted tree, either making all its edges point away from the root—in which case it is called an arborescence, branching,...
ok
With regards to, header guard guarding system headers in header file?
Do you think it is required, as I shared you that comment
?
20:30
Do you need to header guard system includes? No. There is a very slight benefit to it when you are including multiple headers (the compiler doesn't have to open the files to determine that they have already been included).
I would include any includes within my header file guards, however as I've said, I use a single header guard across the whole file.
I also don't include files from within my headers (that's a personal approach that isn't standard), so I wouldn't normally encounter the issue.
ok
Thank you

  last day (18 days later) »