Re: glib.h: defining functions in header file



On Tue, 29 Jun 1999, Matthew Ahrens wrote:

> glib.h defines several functions (if one is not using gcc):
> g_error
> g_message
> g_warning
> 
> In my opinion, this is bad programming practice. One problem I have run
> into because of this is that I would like to use the macros defined in
> glib.h and glibconfig.h without linking with glib. However, Since these
> functions call g_logv, I must use a swilly workaround to avoid having to
> link with glib.

if you just want to use the macros, you are probably better off simply
copying them.

> One could argue that linking with glib is not really a big deal, but I
> still think that this is bad programming practice.
> 
> I see no reason not to put these functions in the glib shared object,
> insted of in the header file.

the function implementations are not there because we wanted to practice
bad programming, but because there is no way to slide in a library-specifc
preprocessor symbol (G_LOG_DOMAIN) into a normal function call, or to
write macros with variable argument lists in ANSI C (i.e. with non-gcc
compilers).

> 
> Your thoughts?
> 
> --matt
> 

---
ciaoTJ



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