This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[jbaron@redhat.com: [PATCH 0/3] tracepoints: delay argument evaluation]


hi,

While working on some Linux kernel code, I've found that functions that
are declared as 'static inline' are having their arguments evaluated
well before they are used. For example I have a function:

static inline void trace(arg1, arg2)
{
	if (unlikely(enabled)) {
		<use the arguments>
	}
}

If i call 'trace(ptr->arg1, ptr->arg2)', then the pointers are
dereferenced before the 'if' is executed. Is there any way to delay the
argument evaluation until they are used? Am I missing a compiler option?
I am used gcc 4.3.0.

thanks,

-Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]