RE: Avoiding == and = mixup in if statements
RE: Avoiding == and = mixup in if statements
- Subject: RE: Avoiding == and = mixup in if statements
- From: Lance Drake <email@hidden>
- Date: Sat, 22 May 2004 02:33:36 -0600
One way to avoid this problem is to put the CONSTANT in the lvalue
position. The compiler will balk about your attempt to set it.
Plus, it forces a read of the variable - as opposed to relying what's
in some register if you have the variable in the rvalue position. All
such tests in my code are constructed as shown. If I goof and only
type one equal sign, I get an error.
if(nil == somevar) { dependentaction(); }
Lance Drake
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.