Re: const fixes seek commit approval




On 21 Oct 1998, Owen Taylor wrote:
> 
> 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. 
Which is more important IMO than allowing lazy people to avoid typing
'const'...  but I know this is a painful thing to do... :-)

I will prepare an alternate patch, and cast this stuff to the proper
constness in Gtk--, if it is never going to be fixed in Gtk+.

Havoc




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