Re: const fixes seek commit approval



> > const parameters are much more appropriate - they allow people
> > who want 'const' to avoid casts, and don't force anything
> > on people who don't want to deal with 'const' - so if you
> > can make up a version of your patch which avoids const'ifying
> > return values, that would be much nicer.

> All right. They avoid errors like:
> 
> gchar* text = gtk_entry_get_text();
> g_free(text);
> 
> (obviously real instances of this error are more subtle)
> 
> const should both document that this is wrong and get the compiler to warn
> about it. And save time looking at the docs to see whether to free that.

I agree. gtk should be as const-correct as possible (if not more-so).
const is a wonderfully powerful tool to help catch programming errors
during compile-time instead of run-time where it is much more difficult
(especially with examples like above).

People who don't like const or don't want to "worry" about const should
pick up a book on proper program design.

-Paul

-- 
Paul T. Miller                | paul@elastic.avid.com
Principal Engineer            | Opinions expressed here are my own.
Avid Technology, Inc. - Graphics and Effects Software Group



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