From: Daniel T. on 24 Apr 2010 13:06 spinoza1111 <spinoza1111(a)yahoo.com> wrote: > On Apr 24, 11:46�pm, "bartc" <ba...(a)freeuk.com> wrote: > > "Daniel T." <danie...(a)earthlink.net> wrote: > > > Ali Karaali <ali...(a)gmail.com> wrote: > > > > > > I use goto to break nested for loops and I can't see a reason to > > > > ban goto. > > > > > > I'll give you a reason to ban goto. This is a line of BASIC code: > > > > > > 90 x = 5 > > > > > > Now, I ask you, where is the line that was previously executed? Is > > > it directly above line 90, is it directly below it, or could it be > > > anywhere in the program? Because of the goto statement, simply > > > because an unstructured "goto" is possible in the language, you > > > have to analyze the entire program to know the answer. If we ban > > > the use of "goto", we can confidently know exactly what line of > > > code comes before line 90. > > > > Goto's at least are usually confined to the same function; if the > > function is smallish, you don't have to look far to match a goto > > with a label. > > It's not a question of how far you have to look. It is a question of > minimal preconditions. If you have a go to even in a small program, > the code that follows it has a larger set of preconditions. Could you go into more detail? Maybe with some examples?
From: io_x on 24 Apr 2010 13:48 "Mensanator" ha scritto nel messaggio news:5fd893eb-9dda-4c70-bf56-614b0f721874(a)u34g2000yqu.googlegroups.com... On Apr 24, 5:13 am, "io_x" <a...(a)b.c.invalid> wrote: >> [Xpost to: alt.comp.programming, alt.lang.asm, >> comp.lang.c, comp.lang.c++, comp.programming] >> >> the people that speak not good about "goto" >> are uttled wrong; their code bug full etc >> >> more distant is your code from goto >> more your code is bug full and incompresible >> >> the "goto" is the key word for programming; >> all the remain, other than goto or jmp or jc or jz, >> and the easy cpu layout >> is the wrong way for programming >> >> i advise all you >> Good Morning >Yeah, there's nothing more fun than converting BASIC to Pascal. > >Only to discover that goto was used to return from a sub-routine >without clearing the stack. all programming is all about choose the right gotos and how to write them in the page. point, end of programming difficulies, there is nothing to say
From: io_x on 24 Apr 2010 13:48 "Alexei A. Frounze" ha scritto nel messaggio news:9aedd878-0ccc-4f4a-b522-7e80b96f5fc5(a)m25g2000prj.googlegroups.com... >On Apr 24, 3:13 am, "io_x" <a...(a)b.c.invalid> wrote: >> [Xpost to: alt.comp.programming, alt.lang.asm, >> comp.lang.c, comp.lang.c++, comp.programming] >> >> the people that speak not good about "goto" >> are uttled wrong; their code bug full etc >> >> more distant is your code from goto >> more your code is bug full and incompresible >> >> the "goto" is the key word for programming; >> all the remain, other than goto or jmp or jc or jz, >> and the easy cpu layout >> is the wrong way for programming >> >> i advise all you >> Good Morning >Everything may be used, misused and abused, goto included. There are >good and bad usage patterns and goto is not an exception here. I can >list a number of other things that may be just as bad as a poorly used >goto (or as good as a good goto). See? what does it mean "patterns"? all programming is all about choose the right gotos >Alex
From: io_x on 24 Apr 2010 13:48 "spinoza1111" ha scritto Sorry i not have a computer science degree, i have a degree only in math; possible i not merit it too, so possible i not thought enough or not have the instruction for speak about this argument. [for instruction i mean study CS, math, phisic, history, languages, biology, etc etc read books etc etc] Hope so not to be in the ones that not understand problems and propose not good solutions due his lack of think to the argument or for not enough instruction yes there are many ways, where will be the right way? i'm just lazy i'm not like you, all you i think in how i can write something in less words possible or in how beauty something in one page can be; you can tell to "Bohm-Jacopini" that, is not important where there are the enters and where are the exits in a piece of code the important is that all this is readable and followable the important is that the eye can see all the code paths and follow well what happen for >LOAD 0 >STOR i >LBL1: >LOAD i >COMP limit >IFGE LBL19 .. .. .. >IFEQ LBL12 >LOAD j <STOR v >GOTO LBL129 >LBL12: >LOAD k >STOR v2 >LBL129: .. .. .. >LOAD i >ADD 1 >STOR i >GOTO LBL1 >LBL19: here the readability is near to 0 because there is no indentation not multi-line instructions and because the assembly instructions are little they have not need of big words but they have need little len words somethig like <i LBL1: >i|i>=*limit#LBL19 .... cold be better traslated push i LBL1: pop i|cmp i, [limit]|jGE LBL19 .. "mov eax, 19" is not a big operation not has need of big words so could write it just as "a=19" Assembly have one vantage too, when write "mov eax, 19" we know eax is a 32 bit register instead in C or C++ "int a=19;" and don't know how many bit are in "int"
From: io_x on 24 Apr 2010 13:48
"Ali Karaali" ha scritto nel messaggio news:dda9d933-e9c1-418f-b62a-bc30bd1dd16c(a)r27g2000yqn.googlegroups.com... >I use goto to break nested for loops and I can't see a > reason to ban goto. i would use goto or the asm extentions (jz, jnz, jnc, jc) for all the programming > Ali |