Re: CriticalAlert
Re: CriticalAlert
- Subject: Re: CriticalAlert
- From: David Remahl <email@hidden>
- Date: Thu, 20 Dec 2001 22:36:26 +0100
On the other hand, the following construct is one I use very often in Cocoa:
NSArray* myArray = [NSArray arrayWithWhateverInitMethod:NULL];
NSEnumerator* myEnum = [myArray objectEnumerator];
id myStr = NULL;
while( myStr = [myEnum nextObject] )
{
// do whatever
}
That would generate a warning, would it not? And I would have to manually
disable that warning. I understand that the coding style of some people
would be served by a warning about this, but I do not know if one exists in
gcc...Search the docs...
/ david
>
And, of course, make sure you enable warnings, and READ THEM. CodeWarrior
>
will warn when you use if (x=y) (and a warning is appropriate, it is legal
>
syntax, it's equivalent to x=y; if (x)), haven't encountered this with PB
>
yet.
>
>
Donald
>
>
on 12/20/01 2:52 PM, Steve Bird at email@hidden wrote:
>
>
> I came to the conclusion that anyone (me included) who couldn't remember
>
> to use double equals, wouldn't remember to put the constant first, either.
>
> It was a struggle to remember to put the constant first. It was a
>
> lesser struggle to check the double-equals than to re-arrange the
>
> arguments to the comparison operator.
>
> And now it's second nature.