Re: Need C optimization help

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

 



On Sunday 16 May 2010 1:48:24 am Tim Prince wrote:
> On 5/15/2010 2:13 PM, Bill McEnaney wrote:
> > Please forgive me for potentially silly question that may not help Mark
> > speedup his program.  If I understand the "const" keyword, it tells the
> > computer that after a const variable gets its first value, that
> > variable's value will be unchangeable.  So I wonder why our friend has
> > declared some const variables inside a for-loop and why those variables
> > appear on the left sides of the assignment operator inside that loop.
> > Silly question: Could Mark's computer be wasting time by trying to
> > change the value of a variable that already has an unchangeable value?
> 
> No, const simply asks the compiler to notify you when you write code
> which changes the value.  It doesn't make a lot of sense if the value is
> to be modified intentionally.  It does seem like a good idea to clean
> that up, particularly when Mark seems to have difficulty understanding
> which messages relate to his concerns.
> 

>From my own understanding, in the scope the variable is declared in, it 
doesn't change. Each step through the loop and the variable is re-declared. No 
matter, it is simple to cut that part of the program out. I'll post revised 
code in another post, soon.

-Mark


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux