Re: glib.h: defining functions in header file



This can get a real long thread, but... I couldn't help biting the flame
bait here.

On Tue, Jun 29, 1999 at 08:40:42PM -0400, Matthew Ahrens wrote:
| On Tue, 29 Jun 1999, Scott Michel wrote:
| > Arguably, including glib.h and glibconfig.h without expecting to
| > link glib is a bad programming practice, since they make internal
| > calls to glib anyway.  :-)
| 
| Which is exactly what I am complaining about. I suggest that header files
| should not make calls to functions; they should declare functions and
| preprocessor macros.

Well, as long as those macros need some functions -- not of the library in
question, but of any library -- I seem to be unable to determine why a
header would want macros but for:

  1. Declaring constants (which is better done with enums IMHO).
  2. Declaring prototypes.
  3. Writing wrappers to functions (here's our case).

So, as long as there are headers with macros that take arguments, those
macros will certainly need to call some function to do their work and this
bad programming practise will quite likely continue.

I believe that copying the macros you need in some other header, might do
the thing you're striving for anyway...

Cheers.

-- 
     ?     | Giorgos Keramidas       < mailto:keramida@ceid.upatras.gr >
  >(o.o)<  | Phone: +30-932-886457   < mailto:keramida@yahoo.com >
     ^     | "Today is not yesterday's tomorrow, but tomorrow's yesterday."



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