Re: Bonobo stream API mis-naming ...



   I think this problem is going to end up coming up little enough that
   we can just tell people who are affected to fix their include order to
   avoid it. It's really best practice, in any case, to always include
   headers in the order of:

    A) System headers
    B) Library headers
    C) Application headers

This is precisely what will get you into trouble...  You must include
application headers that affect system headers -- such as <config.h>
which defines that _FILE_OFFSET_BITS macro -- before the system headers.

Also (A) and (B) are invariably going to get mixed up since library
headers can and do include system headers you have no explicit need
for in your application code.

"truncate" was the simple example of trouble.  Now think of "stat",
notably "struct stat" vs. "struct stat64".  I think they may have
different sizes on Solaris, but sys/stat.h is a twisted maze of #ifdefs.
(There are four different struct stat64, for example.)

gnome-vfs exports a few "struct stat *" interfaces which makes those
functions practically unusable unless you make sure to compile the
headers users in the same "_FILE_OFFSET_BITS mode" as gnome-vfs was.

The solution is to not step on libc's name space.  Anything else is
living in denial.  Use "Open", not "open".  I realise it may be hard
to change published APIs, but we should change where we can.

Morten
_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers



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