× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Kudos to the list for diagnosing this problem so quickly. I don't have much to add, other than to mention some things that I know about variables that are not explicitly initialized:

o In C/C++, static variables and variables declared at the file level are implicitly initialized to zero (this is part of the language defn).

o Therefore, the problem with uninitialized data is almost always limited to local (automatic) variables, as in this case.

o The value of an uninitialized local variable is very sensitive to the optimization level:

-- At optimization level 10, local variables are loaded from the stack. As pointed out in an earlier post, if the variable is not initialized, you get whatever garbage is in the stack (which can often be zeros).

-- At higher levels of optimization (30 and 40), a variable may be optimized to a register. In that case, the uninitialized value will almost never be zero. Even if a variable is not optimized to a register, it will likely be allocated at a different offset in the stack, which will overlay different garbage. When an optimized program behaves differently than a non-optimized version, this is sometimes the cause.

o When running a program under the debugger, there are additional invocations on the stack that affect the offsets of stack-based variables. As mentioned in another post, this can cause values to change.

- Bob


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.