bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: const local variables


From: Paul Eggert
Subject: Re: const local variables
Date: Sun, 11 Apr 2010 15:19:48 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

I agree with Bruno on this point.  It's hard enough to read C code
without having to wade through all those 'const's on local variables.
The tiny extra benefit that they provide is not worth the overhead on
people trying to read the code.  What's next?  Should we also add
'const' to parameter declarations?  (And if not, why not?)

All other things being equal, we should be encouraging a functional
style in which most local variables and parameters are never modified
once set.  Requiring or encouraging programmers to add these 'const's
works against this goal, and makes code harder to read and maintain.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]