Re: playout garbled in iPhone 3.x Release build (solved)
Re: playout garbled in iPhone 3.x Release build (solved)
- Subject: Re: playout garbled in iPhone 3.x Release build (solved)
- From: Kyle Sluder <email@hidden>
- Date: Sun, 2 May 2010 16:21:26 -0700
On Sun, May 2, 2010 at 3:56 PM, Tim <email@hidden> wrote:
> What you suggested would add an unnecessary instruction unless the compiler
> was smart enough to remove it, which I think is what it did, because I did
> try replacing ( bits >= 0 ) with ( !(bits & 0x80000000 ) ) and it did not
> change the behavior, even though I could plainly see from print statement
> the bits satisfied both of those conditions. Somehow bits = bits + bits; is
> not setting the status register bits which the if( ) branch depends on. Or,
> the branch is incorrectly evaluating the overflow condition. Probably
> something to do with 64-bit support.
Your code relies on undefined behavior. See here for a description of
why your code breaks on GCC 4.1.2:
https://www.securecoding.cert.org/confluence/display/seccode/MSC15-C.+Do+not+depend+on+undefined+behavior
In the future, it would be to your benefit to retrain your brain to
not try to shortcut around the compiler. Write code that describes
your intent rather than an optimal implementation. Then profile and
optimize to the minimum level necessary.
--Kyle Sluder
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden