Re: variable reusing

Hardy Griech <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.user
Message-ID <[email protected]>
On 14.05.2013 20:01, kuldeep dhaka wrote:
:
> while coding (embedded devices) i got an idea.
>
> void uart_send_param(uint8_t before, uint8_t after, uint8_t default_value)
> {
>      uint8_t i = 0;
>
>      uart_send(ASCII_ESCAPE);
>      uart_send(before);
>
>      while(before < vt100_param_getcount())
>      {
>          if(vt100_param_get(i) != default_value)
>          {
>              uart_send_int(vt100_param_get(i));
>          }
>
>          if(++i < vt100_param_getcount())
>              uart_send(VT100_PARAM_DELIMITER);
>      }
>
>      uart_send(after);
> }
>
> in the above code, after sending uart_send(before) , "before" is no more
> useful to me.

Perhaps I'm mistaken, bit what about the "before" usage one statement later?

Do I understand correctly, that you want recycle variable space?  If so: 
don't care, let the compiler handle such situations.

If you are in doubt, generate assember output of your differently 
optimized sources and compare them.

Hardy


------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.