From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "Robert Haas" <robertmhaas(at)gmail(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "KaiGai Kohei" <kaigai(at)ak(dot)jp(dot)nec(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org, "KaiGai Kohei" <kaigai(at)kaigai(dot)gr(dot)jp>, simon(at)2ndquadrant(dot)com |
Subject: | Re: Updates of SE-PostgreSQL 8.4devel patches (r1403) |
Date: | 2009-01-14 15:29:18 |
Message-ID: | 87ab9thpo1.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
"Robert Haas" <robertmhaas(at)gmail(dot)com> writes:
> 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 */
> }
It's not in C89 but look up "alloca".
We don't use it anywhere in postgres currently so it's kind of unlikely we
would start now.
I think C99 does allow what you typed, and I think gcc has an extension to
allow it too.
> 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.
palloc really isn't that expensive, unless you're allocating tons of tiny
objects or you're in a tight loop it's not worth worrying about.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2009-01-14 16:37:35 | Re: A single escape required for log_filename |
Previous Message | Robert Haas | 2009-01-14 15:15:46 | Re: Updates of SE-PostgreSQL 8.4devel patches (r1403) |