Re: g-libs renaming and DIR emulation
- From: Tor Lillqvist <tml iki fi>
- To: Hans Breuer <hans breuer org>
- Cc: gtk-devel-list gnome org, gimpwin-dev yahoogroups com
- Subject: Re: g-libs renaming and DIR emulation
- Date: Wed, 3 Oct 2001 01:20:16 +0300 (FLE Daylight Time)
Hans Breuer writes:
> > > Ok. massive bloat maybe a little strong. But I've always thought
> > > of glib as an additional system abstraction. Why should something
> > > such basic as the DIR emulation _not_ be handled by glib ?
> >It could, but then it shouldn't be called opendir/readdir/closedir,
> >but something in the style of
> >g_open_directory/g_read_directory/g_close_directory. Possibly with
> >some extra functionality thrown in, like (for instance) file name
> >patterns, recursion (ftw emulation, g_directory_walk?), globbing, or
> >whatever.
> But the version you removed was already called g_opendir, ... to avoid
> this kind of trouble. So link or runtime problems shouldn't have happened.
Yes and no. The functions were called g_*, but it did #define opendir
g_win32_opendir etc, and apps were expected to continue using the
opendir etc names. This is what had the possibility to cause trouble.
For instance, if some app source file includes first <glib.h>, then
<dirent.h>, trouble. Or, one source file includes <glib.h>, calls
opendir() (i.e. g_win32_opendir()), and passes the DIR* to a function
in another source file, that did not include <glib.h>, that passes the
DIR* further on to readdir() (thus the mingw one this time). Whoopee.
I still don't see why you find it so hard to add one -I switch and one
library to MSVC makefiles, for the separate dirent library.
(If it had been the other way around:
#ifdef G_HAVE_DIRENT_FUNCTIONS
#define g_opendir opendir
typedef DIR GDirectory;
#else
GDirectory *g_opendir(...)
#endif
etc, no problem. Then GLib apps would have been expected to call
g_opendir() etc instead of opendir().)
> One could even use
> #if !defined (HAVE_DIRENT_H)
> #define opendir g_opendir
> ....
> #endif
Sure, but I still think that it would be a mistake. GLib shouldn't
define or #define stuff that is outside its namespace. GLib doesn't do
any other system or C library abstaction or emulation like that. It's
the other way around, g_something() calls something() if it exists, or
implements it itself. It's useful to know that the G* and g_* stuff,
and only that, is from GLib.
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]