Re: [gnome-db] Minor API change and MySQL [update/delete]_row

On Wed, 2003-10-29 at 01:28, Steve Fosdick wrote:
> On 2003.10.27 20:09, Rodrigo Moya wrote:
> > Paisa Seeluangsawat <paisa unt edu> wrote:
> > >  GdaDataModel *
> > > -gda_row_get_model (GdaRow *row)
> > > +gda_row_get_model (const GdaRow *row)
> > >  {
> > >
> > hmm, again, this looks bad to me. I know it's not easy to come up  
> > with a good const/non-const setting, but this totally breaks GNOME  
> > standards.
> > You've got always, in other GNOME libs, the first argument being the
> > class object, with no const. Doing this now breaks that standard.
> Am I missing something here?  AFAIK, if a function is declared to take  
> a const pointer and you have a pointer to a writable object the  
> compiler is quite happy to pass the pointer to the function and doesn't  
> generate any warnings.  As long as the function doesn't try to modify  
> the object pointed to then all works nicely.
> The problem is more likely to occur inside the function when it tries  
> to pass the pointer along to another function that doesn't have the  
> const declaration.
yes, right. The problem is that we've got a lot of functions that modidy
the object that get const. Or at least some, which makes us needing the
get_updatable_row/_value, just to get a non-const.

I am more and more in favour of not returning const from the functions,
and make the documentation clearly state not to free that returned

This is how it's done in most GNOME libs (gtk_tree_view_get_model, for
instance). We should just return const when it's a string, in the
gda_value_get_string function.

Would that be too confusing, if all other GNOME apps do the same?


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