Re: C question for you old guys ;-)
Re: C question for you old guys ;-)
- Subject: Re: C question for you old guys ;-)
- From: Marcel Weiher <email@hidden>
- Date: Mon, 9 Jun 2003 11:30:51 +0200
On Monday, June 9, 2003, at 03:03 Uhr, Daryn wrote:
On Sunday, June 8, 2003, at 07:18 PM, Gregory Weston wrote:
On 6/8/03 at 3:09 PM, Marcel Weiher wrote:
true -- i should've just cut-and-pasted it in to mail, but i found
that i had put a semicolon right after the if statement (so
obviously
it would 'return nil;' every time!
I've made it a habit ( "coding standard", if you will) to always use
{}
for if, while, for, etc.
I'll second Marcel's implied recommendation. In fact, I _did_ make it
a standard
in my shop. It's good to be the chief. Or at least the shaman.
While I agree, the recommendation is a non sequitur. These both
compile the same, and suffer from the same mistake:
if(spriteInfo == NULL); return nil;
if(spriteInfo == NULL); { return nil; }
I guess I should have been a little more explicit. I wouldn't do
either of the above, but rather:
if ( spriteInfo == NULL ) {
return nil;
}
(I actually used to prefer putting open curly brace on a separate line,
but came into a shop where it is done this way and didn't notice that
much of a difference either way).
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
f0249ab8b1af193ef5addcf39fdff5ca
_______________________________________________
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.