Free Republic
Browse · Search
News/Activism
Topics · Post Article

To: microgood

My rule of thumb was, if you couldn't see the entire function on one screen, it was time to break it up. Obviously switch statements couldn't always follow this rule, but I loathed deeply nested conditionals.

I never used a goto.


96 posted on 11/15/2005 5:39:42 PM PST by js1138 (Great is the power of steady misrepresentation.)
[ Post Reply | Private Reply | To 93 | View Replies ]


To: js1138

I didn't learn about the "goto" statement until my last week of C++ when one of the students mentioned he had come across it in an online tutorial. The instructor acknowledged it could be used, but then told us he'd flunk anyone in the class who included it in his coding. Evidently "goto" is a four-letter word in the programming world...


97 posted on 11/15/2005 5:44:31 PM PST by Junior (From now on, I'll stick to science, and leave the hunting alien mutants to the experts!)
[ Post Reply | Private Reply | To 96 | View Replies ]

To: js1138
I never used a goto.

I did, all the time. It was in my Apple II days, using Apple BASIC. I was young and foolish, and I thought GOTO and GOSUB were wonderful. Now, listening to you guys, I wonder where I went wrong.

98 posted on 11/15/2005 5:51:35 PM PST by PatrickHenry (Expect no response if you're a troll, lunatic, retard, or incurable ignoramus.)
[ Post Reply | Private Reply | To 96 | View Replies ]

To: js1138
My rule of thumb was, if you couldn't see the entire function on one screen, it was time to break it up. Obviously switch statements couldn't always follow this rule, but I loathed deeply nested conditionals.

I was the same way in the C World (I did most of my coding of straight C in DOS). Windowz with C++ makes smaller functions harder, as you have to do the work where the hook is, and deal with the .h file dependency mapping problems as well but I agree a function should normally do one thing and do it well.

I never used a goto.

I hate them as well except in a very few cases. I once had to rewrite a VB 6 program that used all gotos and no if then statements at all. It was very painful and I cursed the idiot who originally wrote it frequently.
103 posted on 11/15/2005 5:53:47 PM PST by microgood
[ Post Reply | Private Reply | To 96 | View Replies ]

To: js1138

Obviously switch statements couldn't always follow this rule, but I loathed deeply nested conditionals.

Switch statements are 'gotos' in disguise.

108 posted on 11/15/2005 5:59:34 PM PST by ml1954 (NOT the disruptive troll seen frequently on CREVO threads)
[ Post Reply | Private Reply | To 96 | View Replies ]

To: js1138
I never used a goto.

At least not knowingly.

0B35:0793 7403          JZ      0798
0B35:0795 E90700        JMP     079F
0B35:0798 8346D601      ADD     WORD PTR [BP-2A],+01
0B35:079C E9A4FF        JMP     0743
0B35:079F C45ED6        LES     BX,[BP-2A]
0B35:07A2 26            ES:
0B35:07A3 8A07          MOV     AL,[BX]
0B35:07A5 25FF00        AND     AX,00FF
0B35:07A8 3D3000        CMP     AX,0030
0B35:07AB 7D03          JGE     07B0
0B35:07AD E99400        JMP     0844
0B35:07B0 C45ED6        LES     BX,[BP-2A]

121 posted on 11/15/2005 6:27:37 PM PST by AndrewC (Darwinian logic -- It is just-so if it is just-so)
[ Post Reply | Private Reply | To 96 | View Replies ]

Free Republic
Browse · Search
News/Activism
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson