Declarations near usage
Declarations near usage
- Subject: Declarations near usage
- From: James Hober <email@hidden>
- Date: Wed, 16 Oct 2002 11:48:48 -0700
One thing I don't like about Objective C is that you have to declare variables at the top of a block. I think code that declares variables near their first use is much more readable. This is the norm in C++.
To get around this in Objective C, I sometimes add blocks (open and close parenthesis) in the middle of my methods. Then I can declare variables at the top of this block. I also declare variables, as needed, at the top of blocks that follow if
statements.
When done within reason, this seems to make Objective C code more human readable, but I wonder if it introduces any slight inefficiencies. How about efficiency of declarations in loop bodies?
Comments?
_______________________________________________
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.