begin  quoting Christopher Smith as of Sun, Oct 01, 2006 at 11:15:20AM -0700:
> Stewart Stremler wrote:
> > begin  quoting Christopher Smith as of Sun, Oct 01, 2006 at 12:39:25AM 
> > -0700:
[snip]
> I'm having a hard time reconciling this with the facts. There is a
> specific cast operation for getting rid of const (const_cast<>). It's
> hard to imagine that the intent of that was anything other than giving a
> programmer a way to explicitly ignore const. You have to know what you
> are doing when you use it, but that's true of any "this is likely a
> stupid move so we're gonna make you be explicit about it" operation in a
> language.
> 
> const Foo *bar = blah();
> Foo* non_const_bar = const_cast<Foo*>(bar);

That looks more like C++ than C99.

I suspect we're talking about different languages.  (I also lack a good
C99 book, but that's my own fault.)

[C++ rant deleted, as it's inappropriate for this thread.]

My problem with const almost always comes down to not using it consistently,
and then starting from the wrong side ("Oh, I think I'll make this a
const. Whoops, that function doesn't take const, but now it needs
to. Whoops, it passes that value on to a function that doesn't use 
const either!").  And when one is done inserting "const" in all the places
that should have "const" in 'em.... the code has been uglified. Bleah.

I dunno. It may be that I object to truncated (key)words, and the
fundamental objection is merely an aesthetic one; coupled with the
experience of playing chase-the-const across a codebase a few times,
my reaction may be less rational and more emotional than I supposed.

-- 
_ |\_
 \|

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to