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]

Re: why are we not using const?



On Jun 27, 2006, at 6:29 AM, Manuel López-Ibáñez wrote:


On 27/06/06, Andrew Haley <aph@redhat.com> wrote:
Well, const functions are nonstandard, and gcc itself is written in
Standard C so they can't be used.  But As for const args, I can't see
any good reason not to use them, and there are 400 uses in gcc.

I meant const arguments, sorry for the confusion. What about: 'const' applied to trees, for example:

void foo(const tree type, const tree expr)

Perhaps there is some drawback there?

They are used, just not much.


More in the C front-end than other places:
c-decl.c:push_parm_decl (const struct c_parm *parm)

cfgloop.c:num_loop_branches (const struct loop *loop)
cfgloop.c:loop_latch_edge (const struct loop *loop)

varasm.c:const_hash_1 (const tree exp)
varasm.c:compare_constant (const tree t1, const tree t2)
etc.

-- Pinski



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]