Re: break statement
From: Mark Broadbent (no-spam-please_at_no-spam-please.com)
Date: 05/06/04
- Next message: Lucas Ponzo: "Sockets / Remoting / Web Service ?"
- Previous message: Martin Robins: "Re: Windows Setup & Service"
- In reply to: andrea catto': "Re: break statement"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: break statement"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 6 May 2004 19:04:25 +0100
why dont you read my goddam post before jumping on your high horse!
i.e. the 2nd sentence which reads "however this is usually necessary when
the code is bad."
and the 3rd line which reads "you could do a secondary && test within the
while loop -either moving the if statement test itself, or if that is not
possible setting a boolean flag"
or even the code example on the 5th line onwards.......
:(
p.s.
I used GOTOs in Texas Intruments 99 days (pre dating DOS by around 10
years) -so what?!
A jump is valid in any language that it has been implemented but should be
used ONLY if it is the last resort AND ideally suited to the task in hand.
--
Br,
Mark Broadbent
mcdba , mcse+i
=============
"andrea catto'" <acatto@dataflight.com> wrote in message
news:uqu2NH5MEHA.2736@TK2MSFTNGP11.phx.gbl...
> AHHHHHHHHHHHHHH
> NO GOTO PLEASE !!!!!!!!
>
> It is possible............ EVERY GOOD PROGRAMMED WOULD NEVER USE GOTOS....
>
> I used gotos in gwbasic in the msdos days, !!!!!!!! aweful, I used
> gotos/jmps in assembly back then.......
> in assembly only they are necessary.......
>
> in C they are provided and yet they make the code flow hard to deal with
and
> dont achieve things any better then using while/loops/fors....
>
> just refer to what Gabriele G. Ponti first wrote, use beark; to get off
the
> inner loop and a flag to get off the outer one or yet anothe break.
>
>
>
> "Mark Broadbent" <no-spam-please@no-spam-please.com> wrote in message
> news:OckOl54MEHA.2540@TK2MSFTNGP10.phx.gbl...
> > whilst I am no expert, let me make a few comments.
> > You could use the goto statement (with a label to jump to) however this
is
> > usually necessary when the code is bad.
> >
> > From your code snippet it is very hard to see exactly what you are
trying
> to
> > do but the chances are you could do a secondary && test within the while
> > loop -either moving the if statement test itself, or if that is not
> possible
> > setting a boolean flag
> > e.g.
> >
> > bool loopFlag = true;
> > while (intCurCategory < intTotalCategories && loopFlag)
> > {
> > for (intPageIter = 0;intPageIter< ITEMS_PER_PAGE;intPageIter++)
> > {
> > if (intPagesDisplayed>ITEMS_PER_PAGE)
> > loopFlag = false;
> > break; //this will break the for loop
> > intPagesDisplayed++
> > }
> > }
> >
> > The other thing that strikes me about the code is the god awful naming
of
> > the integers. Ive been banging on for a while in the CSharp newsgroup
> about
> > the lack of a firm standard when naming private variables , controls
etc.
> > And I intend to put this right myself sometime because it's something
that
> I
> > believe slows down development time cos you are constantly thinking
"what
> > shall I call this". I think the general consensus is that for private
> > variables you should name them in Hungarian format (as you did) , but
you
> > dont need the "int" in a type safe environment this is extreme overkill
> in
> > my opinion (plus is confusing to the eye when a variable declaration
could
> > be "int variableName = value", also the names should be functionally
> > descriptive (as you did) rather than abbreviated rubbish.
> > For my form controls however I am currently of the opinion to prefix
those
> > (a la VB format) since it makes my life easier finding them using
> > intellisense however I have had one expert tell me he doesnt do this
> either!
> >
> > I hope some of this helps! Good luck.
> >
> > --
> >
> > Br,
> > Mark Broadbent
> > mcdba , mcse+i
> > =============
> > "Patrick" <patl@reply.newsgroup.msn.com> wrote in message
> > news:eFqU8i4MEHA.2976@TK2MSFTNGP10.phx.gbl...
> > > How could I break out of the while loop within the for/if loop below
> > >
> > > while (intCurCategory < intTotalCategories)
> > > {
> > > for (intPageIter = 0;intPageIter< ITEMS_PER_PAGE;intPageIter++)
> > > {
> > > if (intPagesDisplayed>ITEMS_PER_PAGE)
> > > break; //trying to break out of the while loop
here!
> > > intPagesDisplayed++
> > > }
> > >
> > > }
> > >
> > >
> >
> >
>
>
- Next message: Lucas Ponzo: "Sockets / Remoting / Web Service ?"
- Previous message: Martin Robins: "Re: Windows Setup & Service"
- In reply to: andrea catto': "Re: break statement"
- Next in thread: Daniel O'Connell [C# MVP]: "Re: break statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading