On Wed, Jan 14, 2009 at 10:00 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Bruce Momjian <br...@momjian.us> writes:
>> KaiGai Kohei wrote:
>>> However, it also seems to me that PostgreSQL implementation tend to
>>> avoid to use inline functions actively.
>
>> I thought one advantage of using macros is that we force the inlining,
>
> The (only) good thing about macros is they're portable: they work,
> and work the same, on every C compiler.  This cannot be said of "inline".

Just out of curiosity, does C89, or whatever standard we follow, allow this?

int
somefunc(int x)
{
    int foo[x];
    /* use foo[] for scratch space */
}

Obviously this is a bad plan if x can be a big number because you
might crash your stack, but suppose we know that's not an issue?  It
seems a shame to have to do palloc/pfree in a situation like this.

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to