Re: minor api issues



Havoc Pennington <hp redhat com> writes:

> Owen Taylor <otaylor redhat com> writes: 
> >  gboolean foo (const char *a, G_CONST_RETURN char **b);
> > 
> 
> Keep in mind the tricky part that we can't tell from this prototype
> whether we have an "out string" or "in string[]"

Well, the "RETURN" there should be a strong hint. ;-)
 
> G_CONST_RETURN is decidedly wrong, wrong, wrong for "in string[]"

Yes, and unfortunately, there is nothing good for in string[].

 const char * const *b

is "correct" in some sense, but does require a cast for almost
everybody, so it's probably better to stick to 

 char **b

And keep the cast and reading the prototype simpler.
 
> People are going to screw this up, it probably needs some heavy noting
> in the G_CONST_RETURN docs.

I'm not so worried about it. G_CONST_RETURN is ugly enough that
people won't just go blindly using it everywhere they mean 'const'.

That is, I think it should be _explained_ in the docs, but I
don't think it needs to be beaten over the head.

                                        Owen 




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