lkml.org 
[lkml]   [2006]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/13] hrtimer: remove useless const

* Andrew Morton <akpm@osdl.org> wrote:

> Roman Zippel <zippel@linux-m68k.org> wrote:
> >
> > On Mon, 13 Feb 2006, Andrew Morton wrote:
> >
> > > const arguments to functions are pretty useful for code readability and
> > > maintainability too, if you use them consistently.
> >
> > I could understand that argument, if gcc would warn about it in any way.
>
> It does. If a function tries to modify a formal argument which was
> marked const you'll get a warning.
>
> We're talking about different things here. My point is that it is
> perverted and evil for a function to modify its own args (unless it's
> very small and simple), and a const declaration is a useful way for a
> maintenance programmer to be assured that nobody has done perverted
> and evil things to a function.

good point. I dont think it's "evil" (or as Roman has put it, "bogus")
in any way, and it should be up to the authors of the code to decide one
way or another. [An added bonus for me is that in my editor the 'const'
keyword is color highlighted, so const args are visually separate from
non-const arguments]

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-13 21:03    [W:0.068 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site