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

Segher Boessenkool segher at wanadoo.nl
Thu Nov 16 01:46:48 PST 2000



> 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,

Well, you have:

dinges *x;

x = (dinges *)malloc(N * sizeof(dinges));

> 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++.

Yep. But I would say: C++ is somewhat close of being a superset 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

That's one thing...

> a small function (er. macro, I guess) to make this work better, I would

Did that, it matters at two or three places...

> think. Might still be better to use malloc/free in some cases, though.

Problem is, some processors don't like data being at the same spot as
return adresses. It kills the internal processor return stack, or
something. It's not that big a problem if we inline most routines
(and we can, because most (sensitive) routines are called from one
spot only). But it's nice to see if malloc() helps out. It's worth
a try...

Ciao,

Segher

--- >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