Theocacao
Leopard
Design Element
Comment on "The Year in Mac Development"
by Bret — Jan 03
Re: lexical scopes:

GCC's done that for a long time.

My code is full of stuff like this (just to pull a contrived example off of the top of my head):

-(void)someFoo:(int)bar
{
while(bar--)
{
int myVar=bar*someOtherFunc();
myIvar+=myVar;
};
};

... and of course, if you try to access myVar outside of the while loop, the compiler complains.

You don't have to have your declarations at the top of the block either:

{
someFoo++;
int someBar=37;
someBaz+=someFoo*someBar;
};


P.s. - yeah, I like semicolons after my closing blocks. It's a style thing. **shrug**
Back to "The Year in Mac Development"
Design Element

Copyright © Scott Stevenson 2004-2015