On error goto....
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
As an exclusively C# shop, I know it's going to be a bad morning if I open up any code and find VB in it. (I'm not kicking VB here - just saying that I shouldn't find any).
Deja View - the feeling that you've seen this post before.
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
Why would one like to spoil the day and the bright cheerful morning by looking at a mourning sick and sluggish code like VB?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson -
As an exclusively C# shop, I know it's going to be a bad morning if I open up any code and find VB in it. (I'm not kicking VB here - just saying that I shouldn't find any).
Deja View - the feeling that you've seen this post before.
Mmm. I fear it's not the language that's the problem here though...
-
Why would one like to spoil the day and the bright cheerful morning by looking at a mourning sick and sluggish code like VB?
Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis LevinsonIt's not so much 'like' as 'have to'.
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
After all, it could also have been
ON ERROR RESUME NEXT
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist -
Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:
He who makes a beast out of himself gets rid of the pain of being a man
Phannon wrote:
At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.
Stupid ivory-tower taboos. A
goto
statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].DoEvents: Generating unexpected recursion since 1991
-
After all, it could also have been
ON ERROR RESUME NEXT
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist:) very true. I shall be thankful for small mercies.
-
Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:
He who makes a beast out of himself gets rid of the pain of being a man
use
goto
,continue
orbreak
, you fail (break only allowed in switch statements.) use more then one exit in your function, you fail. and the prof was right... :)V.
Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive -
Phannon wrote:
At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.
Stupid ivory-tower taboos. A
goto
statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].DoEvents: Generating unexpected recursion since 1991
I fully agree with you. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Phannon wrote:
At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks.
Stupid ivory-tower taboos. A
goto
statement can be helpful. But you should never use it where a structured control statement would be more appropriate. For some interesting reading see Gotos Considered Harmful and Other Programmers' Taboos[^].DoEvents: Generating unexpected recursion since 1991
Mike Dimmick wrote:
Stupid ivory-tower taboos.
Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
Paddy Boyd wrote:
Stupid ivory-tower taboos.
I almost worked on a POS, also littered with those, but with the added qualifications, such as
If Err.Number = nnn Then Resume Next
Trying to find an error causing line was hell, because with Break on All Errors turned on, nearly every line caused an error, which was handled by code such as the above. Things like invalid array indexes, empty strings etc. that could all have been ignored with a proper code check, such asIf i > UpperBound Then DoNothing
, but no, it was justWrite strData(i)
and let the f****ing error handler see if the error was important. -
Mike Dimmick wrote:
Stupid ivory-tower taboos.
Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.
Agreed! On Error Resume Next, to me, always seems like saying "Eh. Who cares about what we're doing. The user should notice that half their data failed to get through our routine and fix it themselves..."
-
You know it's not going to be a good morning when you open up a legacy VB.net project and find hundreds of functions littered with ON ERROR GOTO's...
It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.
DoEvents: Generating unexpected recursion since 1991
-
It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.
DoEvents: Generating unexpected recursion since 1991
I know. And i believe, written from scratch...
-
Bleh, goto X| At uni we had the true evil of the statement hammered into us on a C++ course, for every goto in our assignments you will lose 50% of the marks. :laugh:
He who makes a beast out of himself gets rid of the pain of being a man
-
use
goto
,continue
orbreak
, you fail (break only allowed in switch statements.) use more then one exit in your function, you fail. and the prof was right... :)V.
Stop smoking so you can: Enjoy longer the money you save. Moviereview ArchiveI often use continue. It greatly improves readability.
-
It's the only way of handling exceptions in VB6. VB6 also wouldn't give you a call stack so you basically had to do it yourself by putting On Error Goto in every function. Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy. If it was written new in VB.NET, not a translation from VB6, then the programmer should be shotretrained.
DoEvents: Generating unexpected recursion since 1991
Mike Dimmick wrote:
Now, if it was ported to VB.NET and not translated to Try/Catch, then you have my sympathy.
Or if it was, but with every (now) method being neatly wrapped up in a 'try' 'catch (Exception ex)' 'throw new Exception("Error!", ex);'
-
Mike Dimmick wrote:
Stupid ivory-tower taboos.
Yes, I agree, but On Error Resume Next should be punished by stoning to death with golf balls.