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

Re: [Linux-cluster] [PATCH 0/4] fence



On Fri, 2005-02-18 at 12:01 +0800, David Teigland wrote:

> For reference, existing:
> 
> #define die(fmt, args...) \
> do \
> { \
> 	fprintf(stderr, "%s: ", prog_name); \
> 	fprintf(stderr, fmt "\n", ##args); \
> 	syslog(LOG_ERR, fmt, ##args); \
> 	exit(EXIT_FAILURE); \
> } \
> while (0)
> 
> patch does:
> 
> static inline void die(const char *fmt, ...)
> {
> 	va_list ap;
> 	fputs(prog_name, stderr);
> 	fputs(": ", stderr);
> 	va_start(ap, fmt);
> 	vfprintf(stderr, fmt, ap);
> 	fputs("\n", stderr);
> 	vsyslog(LOG_ERR, fmt, ap);
> 	va_end(ap);
> 	exit(EXIT_FAILURE);
> }

Note: Specifying inline doesn't always guarantee that inlining will
occur.  In fact, you can't inline a function with variable length
arguments with GCC...

http://gcc.gnu.org/onlinedocs/gcc/Inline.html

-- Lon


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