nanogui: usage of posix functions in src/engine/ and src/drivers/


Previous by date: 28 May 2005 17:26:51 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Jachym Holecek
Next by date: 28 May 2005 17:26:51 +0100 Re: config files -> config.h, Jachym Holecek
Previous in thread: 28 May 2005 17:26:51 +0100 usage of posix functions in src/engine/ and src/drivers/, Alexander Neundorf
Next in thread: 28 May 2005 17:26:51 +0100 Re: usage of posix functions in src/engine/ and src/drivers/, Greg Haerr

Subject: Re: [nanogui] usage of posix functions in src/engine/ and src/drivers/
From: Jachym Holecek ####@####.####
Date: 28 May 2005 17:26:51 +0100
Message-Id: <20050528162647.GB17914@merlot.ics.muni.cz>

Hello,

> I'd like to replace the abort(), fprintf() and similar calls in drivers/ and 
> engine/ with macros in order to make it more portable:

Abstracting error/debug reporting is a Good Thing IMO.

> #ifdef __ECOS
>   #define ABORT() CYG_FAIL("aborted");
>   #define DEBUG_PRINTF(args...) diag_printf(args...)
> #else
>   #define ABORT() abort()
>   #define DEBUG_PRINTF(args...) fprintf(stderr, args...)
> #endif
> 
> What do you think ?

I'd avoid vararg macros with something like:

#ifdef FOOBAR
void debug(const char *, ...);

#  define ABORT() 	foo("aborted")
#  define DEBUG(arg) 	do { debug arg ; } while(/*CONTCOND*/)
#else ...
#endif

Or have varag macros been made sanely portable while I was sleeping? ;)
Alternatively, one could just make ABORT(), DEBUG() etc. real functions,
selected on platform basis.

	Regards,
		-- Jachym Holecek

Previous by date: 28 May 2005 17:26:51 +0100 Re: Pending patches/bug/requests ... list available on the FTP, Jachym Holecek
Next by date: 28 May 2005 17:26:51 +0100 Re: config files -> config.h, Jachym Holecek
Previous in thread: 28 May 2005 17:26:51 +0100 usage of posix functions in src/engine/ and src/drivers/, Alexander Neundorf
Next in thread: 28 May 2005 17:26:51 +0100 Re: usage of posix functions in src/engine/ and src/drivers/, Greg Haerr


Powered by ezmlm-browse 0.20.