[cfe-dev] new -Wuninitialized implementation in Clang
afternoon.tree at gmail.com
Fri Feb 4 10:19:23 PST 2011
If I could choose I rather would get correct warnings instead of false
positives that in the require me to initialize everything everywhere.
I am not concerned with the cost. The extra compile time is offset by
being able to trust the warning instead of digging through to verify
On Feb 4, 2011, at 9:26, Henry Mason <thefridgeowl at gmail.com> wrote:
> On Feb 4, 2011, at 6:02 AM, Michael Price - Dev wrote:
>> On Feb 4, 2011, at 12:32 AM, "John N. Lehner" <jlehner at apple.com> wrote:
>>> On Feb 3, 2011, at 8:27 PM, Johannes Schaub (litb) wrote:
>>> int x = 0;
>>> if (flag)
>>> x = ...
>>> if (flag)
>>> and use(0) is wrong. While that may seem contrived, I saw it happen
>>> in a loop once, and use(0) turned out to be expensive.
>> I strongly disagree. How can use(0); be worse than use(garbage that
>> can potentially be zero or that can potentially crash your app causing
>> data corruption);
> Obviously having non-deterministic behavior like that is bad. However, when you declare x uninitialized, the static analyzer *can* correctly determine that the first use(x) is valid while the second one is not. It would really suck to make our smart analysis less effective because everyone is structuring their code to please the dumb analysis.
> I suppose for those willing to eat the performance cost, you could just compile without -Wunintialized and always uses the static analyzer's uninitialized checker.
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
More information about the cfe-dev