Re: Thoughts on CodeWarrior 8 for Cocoa programming?
Re: Thoughts on CodeWarrior 8 for Cocoa programming?
- Subject: Re: Thoughts on CodeWarrior 8 for Cocoa programming?
- From: Jim Correia <email@hidden>
- Date: Wed, 12 Jun 2002 05:29:45 -0400
On Wednesday, June 12, 2002, at 03:24 AM, Thomas Deniau wrote:
- You get a warning on, in -init, if (self = [super init]) . Very
frustrating (of course you can suppress it, but it's enabled by
default).
The possible unwanted assignment warning has saved my bacon several
times. I think leaving the warning on (and explicitly turning it on
in Project Builder/gcc) is a wise idea.
One habit you can get into is to write
if (result = noErr)
{
// do work
}
as
if (noErr = result)
{
// do work
}
then the assignment cannot take place accidently. You'll get a not
an lvalue error. If you write the first form, you'll get the
possible unwanted assignment warning.
You can write your code in such a way that you can be explicit
about the assignment and avoid the warning.
if (noErr == (result = CallSomeFunction()))
{
}
or
if ( (result = noErr) )
{
}
Jim
_______________________________________________
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.