Re: While loop style
- From: "Joe Butler" <ffffh.no.spam@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Jul 2005 14:06:49 +0100
OK, thanks Rodrigo,
The person had included the semi-colons. The code compiled, but was not
tested.
I found the code and had to ask what it was actually supposed to do.
Using the braces would have made it clear what the intention was and more
importantly would have made the error much less likely to happen, since the
brackes are what's important, not the indentations.
"Joe Butler" <ffffh.no.spam@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OwRQa3dkFHA.4000@xxxxxxxxxxxxxxxxxxxxxxx
> Yes, go with that.
>
> Its meaning is absolutely clear - even if someone does some sloppy editing
> around it at a later time.
>
> Why have while loops with blocks and another while loop withouts blocks
just
> for the sake of typing a couple of braces?
>
> I've actually seen people write code like this:
>
> while(whatever)
> DoStuffFunction()
> DoSomeOtherSubtleStuffThatHasBeenAddedLaterFunction()
>
> Now, what do you suppose would have happened if there were braces around
> that while in the first place?
>
>
> "Charles Tam" <CharlesTam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:DAF56A25-FB5B-4F8E-A347-D0BD2F60FCD2@xxxxxxxxxxxxxxxx
> > I've a while loop as below, and would like to execute the true
expression
> > until false. Is my style of ";" correct?
> >
> > FYI: queue.remove() returns true if element is removed, false if queue
is
> > empty. Note, the queue do not provide a isEmpty funtion.
> >
> > ////////////
> > while ( queue.remove() )
> > {
> > ;
> > }
> > ////////////
> >
>
>
.
- Follow-Ups:
- Re: While loop style
- From: Rodrigo Corral [MVP]
- Re: While loop style
- References:
- While loop style
- From: Charles Tam
- Re: While loop style
- From: Joe Butler
- While loop style
- Prev by Date: Re: While loop style
- Next by Date: Re: VS2005 doesn't like its own suggestions
- Previous by thread: Re: While loop style
- Next by thread: Re: While loop style
- Index(es):
Relevant Pages
|