Re: A89: Other storage class modifiers


[Prev][Next][Index][Thread]

Re: A89: Other storage class modifiers




Kevin Goodsell wrote:
> 
> Do any of the other storage class modifiers (register, volitile) have any
> meaning in TI-GCC? I never did understand what volitile was good for. Maybe
> it's only useful when multiple programs share the same variables.
> 

"volatile" prevent a variable to be stored in a register, even while
operations are performed on it. This is useful, for example, when a
variable is used both by the main program and by an autoint. If an
autoint try to modify a variable while it is stored in a register in the
main program thread, the change will be lost as soon as the register is
stored back. "volatile" solve this problem.

Concerning "register", I don't think it should be used nowadays, since
modern compilers like GCC are efficients enough to make this choice as
required.



References: