On Sun, Apr 20, 2008 at 7:20 AM, Uli Kusterer <[EMAIL PROTECTED]> wrote: > Am 20.04.2008 um 11:45 schrieb Jean-Daniel Dupas: > > > > I greatly prefere the C99 way to do it. It prevents variables conflict if > you have more than one loop in your method. > > > > for (int idx = 0; idx < maxCount(); idx++) { > > > > } > > > > > Yeah, I like that, when I can use it. It's just not always possible, and > sometimes you want several loops to share a counter. > > Besides, it wouldn't have illustrated the point I was trying to make, that > I always initialize variables, even if I'll be smashing their value right > thereafter. Maybe I should have gone with: > > BOOL success = NO; > > success = [[NSFileManager defaultManager] > changeCurrentDirectoryPath: @"/"]; > > or whatever.
In such a case, I don't declare the variable until I actually need it: BOOL success = [[NSFileManager defaultManager] changeCurrentDirectoryPath: @"/"]; That way, there is zero chance of it being uninitialized at any point before use, as it doesn't exist before its first use. -- Clark S. Cox III [EMAIL PROTECTED] _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]