Re: API change for g_get_current_dir() (#59703)



On Mon, 10 Sep 2001, Tim Janik wrote:

> On Mon, 10 Sep 2001, Alex Larsson wrote:
> 
> > g_get_current_dir() currently returns "/" on failure. This is quite 
> > broken, since that is also a valid correct return value. I dicusssed this 
> > a bit woth owen, and we think that the best solution is to add a GError to 
> > the function. Then we would return NULL and set the GError on error.
> > 
> > The advantage of this is that it breaks the compilation of any code that 
> > uses this function, whereas just returning NULL on error would cause apps 
> > to segfault.
> > 
> > This will cause a bit of breakage though, g_get_current_dir() is 
> > references in about 80 files according to lxr.
> > 
> > Do people have strong opinions on this?
> 
> yes, changing the prototype is a very bad option
> i'd think. you might consider adding another function
> that handles the error case if people really need
> that.

Do you think we should keep returning "/" on error, or should we return 
NULL?

g_get_current_dir_with_error() is just bad. 

/ Alex






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