Re: CriticalAlert
Re: CriticalAlert
- Subject: Re: CriticalAlert
- From: Andrew Pinski <email@hidden>
- Date: Thu, 20 Dec 2001 17:11:04 -0500
No you can add to your CFLAGS -Wno-parentheses
On Thursday, December 20, 2001, at 05:02 , Kurt Revis wrote:
On Thursday, December 20, 2001, at 01:36 PM, David Remahl wrote:
On the other hand, the following construct is one I use very often in
Cocoa:
while( myStr = [myEnum nextObject] )
{
// do whatever
}
That would generate a warning, would it not? And I would have to
manually
disable that warning.
Out of the box, gcc with Project Builder used to warn about this, if I
remember correctly. Now that I check, it doesn't seem to do it
anymore, which is unfortunate. (If you add -Wall to your compiler
flags, you will get a warning: "suggest parentheses around assignment
used as truth value".)
To avoid the warning, put an extra pair of parens around the
expression. That is:
while ((myStr = [myEnum nextObject]))
This is a pretty well known idiom. (Like all idioms, it doesn't
necessarily make much sense all by itself, though.)
--
Kurt Revis
email@hidden
_______________________________________________
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.