On Tue, Oct 23, 2012 at 11:14 PM, mind entropy <mindentr...@gmail.com>wrote:

> Hi,
>
>   I was reading the mspgcc manual (
>
> http://www.eecs.harvard.edu/~konrad/projects/motetrack/mspgcc-manual-20031127.pdf
> )
> and on Pg 39 its written as
>

I believe there is a more up to date version but I'm not usre where it
lives.  Perhaps Peter can point to it?


>
> "If you execute
> while ((long) a & 0x80000l);
> the program will hang, unless ’a’ is declared volatile. So, do it!"
>

With optimization a will be put into a register (actually two registers
since it is a long) and loaded once.

If a is declared as a volatile, that tells the toolchain that a can change
out from underneath any assumptions
made about contents.  This forces the compiler to reload a into a register
each iteration.


> I did not get it. Why should it hang?
>
> Thanks,
> Gautam.
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to