This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 27/06/06, Daniel Berlin <dberlin@dberlin.org> 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);
typedef union tree_node const *const_tree; void f(const_tree a);
-- Tristan Wibberley
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |