nanogui: usage of posix functions in src/engine/ and src/drivers/
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