Date: Sat, 28 May 2005 18:26:47 +0200 From: Jachym Holecek Subject: Re: [nanogui] usage of posix functions in src/engine/ and src/drivers/ 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 --------------------------------------------------------------------- To unsubscribe, e-mail: nanogui-unsubscribe@linuxhacker.org For additional commands, e-mail: nanogui-help@linuxhacker.org