Re: [HACKERS] Candidate for local inline function? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Candidate for local inline function?
Date
Msg-id 29050.1489782593@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] Candidate for local inline function?  (Kevin Grittner <kgrittn@gmail.com>)
List pgsql-hackers
Kevin Grittner <kgrittn@gmail.com> writes:
> Why do we warn of a hazard here instead of eliminating said hazard
> with a static inline function declaration in executor.h?

> /*
>  * ExecEvalExpr was formerly a function containing a switch statement;
>  * now it's just a macro invoking the function pointed to by an ExprState
>  * node.  Beware of double evaluation of the ExprState argument!
>  */
> #define ExecEvalExpr(expr, econtext, isNull) \
>     ((*(expr)->evalfunc) (expr, econtext, isNull))

> Should I change that to a static inline function doing exactly what
> the macro does?

No, because that code has only days to live anyway.  You'd just
create a merge hazard for Andres' execQual rewrite.

In practice, I seriously doubt that there are or ever will be any
callers passing volatile expressions to this macro, so that there's
not really much advantage to be gained by assuming that the compiler
is smart about inline functions.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: [HACKERS] Candidate for local inline function?
Next
From: Pavel Stehule
Date:
Subject: [HACKERS] Re: new set of psql patches for loading (saving) data from (to) text,binary files