Quoting Wesley Parish <[EMAIL PROTECTED]>:

> Quoting Steve Holdoway <[EMAIL PROTECTED]>:
> 
> > On Tue, 16 May 2006 18:55:16 +1200
> > Rex Johnston <[EMAIL PROTECTED]> wrote:
> > 
> > > Dale DuRose wrote:
> <snip> 
> > The other appalling shortcut at this point is missing out the braces
> and
> > just using the next line as the 'do something' bit. Great until you
> need
> > to do more than one thing, and forget.
> 
> And then there are the people who insist on making the <iteration
> action> the
> <do something> and having empty curly brackets following the end ')' .
> makes
> for interesting reading.
> 
> Eg, 
> #define LARGE 50
> int main(void)
> {
>  int i;
>  char b[LARGE];
>  for (i = 0; i >= LARGE; b[i++]){}
> }
> 
> As i say, hairy code. ;)
> 
> Wesley Parish

Ooops, a few errors:
void main(void) makes better sense, because you're not returning anything;

the for loop merely walks you through the array and if my rethinking is correct,
it would in fact go beyond the array boundaries, so it probably should be
int b[LARGE];

and if you wanted to store anything in the b[LARGE] array, you'd use b[i] = i++
instead.

My bad.

But on the other hand, Lions' Book's full of this sort of construction.  It's
how they managed the file system, for one thing. ;)

Wesley Parish
> > 
> > Those who indent as follows...
> > 
> > for ( initial configuration,...; End conditon; iteration action,... )
> > {
> >     do something...
> > }
> > 
> > are adopting a method designed to save paper on a hardcopy teletype,
> so
> > beware!
> > 
> > My $0.02,
> > 
> > 
> > Steve
> > C bodger since 1984. K&R rules!
> > 
> > 
> 
> 
> 
> "Sharpened hands are happy hands.
> "Brim the tinfall with mirthful bands" 
> - A Deepness in the Sky, Vernor Vinge
> 
> "I me. Shape middled me. I would come out into hot!" 
> I from the spicy that day was overcasked mockingly - it's a symbol of
> the 
> other horizon. - emacs : meta x dissociated-press
>  



"Sharpened hands are happy hands.
"Brim the tinfall with mirthful bands" 
- A Deepness in the Sky, Vernor Vinge

"I me.  Shape middled me.  I would come out into hot!" 
I from the spicy that day was overcasked mockingly - it's a symbol of the 
other horizon. - emacs : meta x dissociated-press

Reply via email to