[Gambas-user] usage of too much GOTO can be bad pracitce or make influence in the code?

nando_f at ...951... nando_f at ...951...
Thu Jun 22 16:32:17 CEST 2017


Sometimes GOTO is needed...especially if you want your code to run faster.

Used properly and judiciously, it can make code reading much easier.

--
Open WebMail Project (http://openwebmail.org)


---------- Original Message -----------
From: Cristiano Guadagnino <criguada at ...626...>
To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
Sent: Thu, 22 Jun 2017 16:24:02 +0200
Subject: Re: [Gambas-user] usage of too much GOTO can be bad pracitce or make influence in
the code?

> Based on your example, I would not find the code using GOTO any more
> readable. Quite to the contrary, instead.
> And I don't understand why you cannot use a sub. What's the problem with
> variables that cannot be solved by passing the needed variables or using
> globals?
> 
> Anyway, coding style is a matter of taste, so go with what you prefer.
> Unless the code needs to be read/perused by others, obviously.
> 
> Cris
> 
> On Thu, Jun 22, 2017 at 4:10 PM, PICCORO McKAY Lenz <mckaygerhard at ...626...>
> wrote:
> 
> > 2017-06-22 10:00 GMT-04:00 Jussi Lahtinen <jussi.lahtinen at ...626...>:
> >
> > > Usually the problem with goto is that it can render the code hard to
> > debug
> > > or read.
> > >
> > AH OK, so in large complex dependences must be avoid..
> >
> > i only use to avoid a similar to this:
> >
> > if isnull(value ) then
> >    ' amount of 4000 lines of code
> >
> > else
> >    ' amount of other lot of lines
> > endif
> >
> > so i put
> >
> > if not isnull()
> >   goto codepiecelabel1
> > endif
> >   ' amount of lines
> >
> > codepiecelabel1:
> > ' here the 4000 lines
> >
> >
> > i cannot use a sub procedures due manage some variables
> >
> >
> > >
> > >
> > > Jussi
> > >
> > > On Thu, Jun 22, 2017 at 4:21 PM, PICCORO McKAY Lenz <
> > > mckaygerhard at ...626...>
> > > wrote:
> > >
> > > > i have some GOTO to avoit large IF-ELSE code blocks and make readable
> > the
> > > > code..
> > > >
> > > > the usage of many GOTO instructions can be bad pracitce or make
> > influence
> > > > in the code?
> > > >
> > > > i remenber that in BASIC always tell me "dont use too much"
> > > >
> > > > of course GAMBAS IS NOT BASIC (umm that sound familiarr... ;-)
> > > >
> > > >
> > > > Lenz McKAY Gerardo (PICCORO)
> > > > http://qgqlochekone.blogspot.com
> > > > ------------------------------------------------------------
> > > > ------------------
> > > > Check out the vibrant tech community on one of the world's most
> > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > > _______________________________________________
> > > > Gambas-user mailing list
> > > > Gambas-user at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > >
> > > ------------------------------------------------------------
> > > ------------------
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> > ------------------------------------------------------------
> > ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list