In Xcode 3.2 in iPhone-SDK 3.1, how do I avoid the "dead storage" error from the CLANG parser?

I just upgraded to Xcode 3.2 and use Build and Analyze to check the old code for errors.

While doing something that I thought was harmless, I get this error:

"Dead store: value stored in" newBook ​​"during its initialization is never read into SpellTest.m"

#define kSpellBookFilename @"TestBookSaver"

    // restore object from disk
    SpellBook *newBook = [[[SpellBook alloc] init] autorelease];
    newBook = [NSKeyedUnarchiver unarchiveObjectWithFile:kSpellBookFilename];

    // show restored object
    NSLog(@"archived copy %@", newBook);


Am I initializing this object incorrectly or is this a false positive?


source to share

1 answer

This is a dead shop. Why are you even initializing a new SpellBook object on the first line of code when you just throw it away on the next line? Just remove the first line (and move the type declaration to the second).



All Articles