[vorbis-dev] BeOS on PPC compile, thread question.

Michael Smith msmith at labyrinth.net.au
Thu Nov 16 00:36:12 PST 2000



At 08:21 AM 11/16/00 +0100, you wrote:
>> Libvorbis is NOT C++. It will not, and should not be expected to, compile
>> as C++. I don't think we'd be interested in patches to make it pseudo-C++.
>> Anything that stops it compiling in a C compiler is a different matter.
>
>Well, if we have:
>
>something * x;
>void * y;
>
>x = y;
>
>if we instead write
>
>x = (something *) y;
>
>it is not only making compiling for C++ work, but it is also cleaning
>up the C code.

I understand that - but most of the problems are with returns from
malloc(), etc. - and in that case, it does NOT make it cleaner or clearer
code in any way (in my opinion). If it really DOES make the code clearer,
that's a different  matter. If the sole advantage is to make it compile as
C++, that's stupid. C and C++ are completely different languages - it's
just that C is somewhat close to being a subset of C++. 

>
>And replacing the alloca()'s with malloc()/free() pairs _could_ be
>useful. (1st for people without alloca() (who cares about-em anyway), and
>2nd for people who are concerned about performance. I'll test if it makes
>a speed difference.)

Agreed on this one - that's NOT a C/C++ issue, it's a "libvorbis is using
non-ANSI features not present on some platforms" issue. It seems very
strange that beos (even old versions) wouldn't have alloca() (or something
identical under a different name), but if that's really the case, sure.

Why would it make a speed difference? Is it because alloca() doesn't
neccesarily align the allocation appropriately? One could wrap alloca() in
a small function (er. macro, I guess) to make this work better, I would
think. Might still be better to use malloc/free in some cases, though.

Michael

--- >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 'vorbis-dev-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 Vorbis-dev mailing list