Post Reply 
New third party firmware (Not HP'PRIME TEAM)
01-06-2016, 07:23 PM
Post: #33
RE: New third party firmware (Not HP'PRIME TEAM)
(01-06-2016 05:28 AM)cyrille de brébisson Wrote:  Hello

>Abuse of goto should be avoided, but it is sometimes much better to have a
>goto than complicated booleans that are required if goto are avoided.
>This is especially true for "implicit" gotos inside loops like break and continue

I use got every once in a while.

The numerical solver has a bunch of them because it was lifted verbatim from the HP48 code which is full of them, and I was unable to extract a clear structure.

An other use of goto is to exit a function in case of error when you have a number of finalization to do.

But, by far the most frequent use of goto is to exit a double (or more) deep loop. This happens all the time and is VERY frustrating to me.

This is why, in PPL, you can do break n; or continue n; (where n is an integer), which allows to break out of n level of loops. This reduces the number of legitimate goto use by at least 90%!

Cyrille

In my opinion when goto is used just to exit a loop, and not freely jump around in the code, it does not really represent the hated/demonic roots of the goto instruction; and this is totally acceptable. C# has goto/label to exit nested loops, similar to other languages that use break "label", etc.

But I am guessing toml is thinking on the other goto Tongue the one that makes possible to have certain state machine behavior without a clean design.

My website: ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: New third party firmware (Not HP'PRIME TEAM) - eried - 01-06-2016 07:23 PM



User(s) browsing this thread: 1 Guest(s)