Subject: Re: qsort problems
To: Peter Seebach <seebs@solon.com>
From: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
List: netbsd-help
Date: 11/09/1996 13:07:08
> Very, very close; unfortunately, you need to cast away the const here,
> or have those be "const TTY_NODE **"'s.
>
> (This is why I dislike const.)
This is why _I_ like const, actually.
If data isn't supposed to be changed, then marking it with 'const':
(1) causes a lot of warnings, and
(2) will keep causing warnings until you either cast it away
or fix all of the places where the 'const' data has its
const-ness violated.
Add gcc's -Wcast-qual, and you've got a real winner.
If data shouldn't be modified, it shouldn't be modified. const helps
enforce that. Certainly, one could design a function that made proper
use with 'const' impossible, but i'd call that bad design...
cgd