[tremor] Re: [PATCH] eliminate alloca() usage
Nicolas Pitre
nico at cam.org
Thu Oct 17 08:21:54 PDT 2002
On Thu, 17 Oct 2002, Michael Smith wrote:
> At 11:40 AM 10/17/02 +0200, you wrote:
> >
> >On 2002-10-17 at 05:38:51 Nicolas Pitre wrote:
> >
> >NP> Anybody with another compiler than GCC please confirm if the attached
> >NP> patch works for you or not.
> >
> >This will only work with GCC, since it is a GCC specific extension. It
> >is definitely not ANSI or ISO C. (Note that I agree that it is a very
> >handy feature, which almost entirely removes the need for an alloca()
> >function.)
>
> Whilst it was at one time a GCC (and other compilers, though far from all
> of them) extension, it's been part of ANSI C for a few years now. C99
> introduces variable-size automatic arrays, so any compiler that supports
> C99 will work with this. alloca() is more portable in practice, though,
> this was only suggested as an alternative for people without alloca().
The ultimate solution would involve extending that patch by declaring
constant arrays using the maximum possible size per the Vorbis
specification. Since the maximum size must be accomodated to be compliant
it won't hurt declaring everything that way and be fully portable.
Pushing this idea further all malloc()/free() could be removed the same way
as well. This way Tremor would become fully predictable with regard to
memory usage, eliminating the need for heap memory.
<p>Nicolas
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Tremor
mailing list