Manuel López-Ibáñez wrote:
On 27/06/06, Daniel Berlin <[EMAIL PROTECTED]> wrote:
Manuel López-Ibáñez wrote:
> Apart from its main
> purpose, I believed that the use of 'const' helps the compiler to
> optimise the code.
It generally doesn't, unless you apply const to the underlying type, and
not just the pointer.
IE you say you have a pointer to a constant piece of memory, not a
constant pointer to a piece of memory.
But... tree is a pointer to "union tree_node" , isn't it? perhaps it
is that "const tree" is not the same as " const union tree_node * " ?
(btw, thanks for taking the time to clarify my doubts...)
typedef union tree_node *tree;
void f(const tree a);
is equivalent to
void f(union tree_node * const a);
ie, it says the pointer is const so there's little point in using it.
typedef union tree_node const *const_tree;
void f(const_tree a);
*would* be meaningful, however.
--
Tristan Wibberley