Comment On Illogical Logic Flow

"I took a job at Initrode Software to help build the bridge to C#/.NET from their current, VB6 codebase," Chris G. writes. "It didn't take me too long to realize that the original programmers of this software — the only product that Initrode sold — had very little real-world experience." [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Illogical Logic Flow

2009-06-01 09:02 • by Drew (unregistered)
DO NOT REMOVE THIS COMMENT!
The Daily WTF is skipping the Real WTF without it.
Very weird.

Re: Illogical Logic Flow

2009-06-01 09:03 • by sponk (unregistered)
That's a bit of a mild wtf. Someone isn't very good at programming. Oh no.
At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.

Re: Illogical Logic Flow

2009-06-01 09:04 • by jammy (unregistered)
Maybe it was because of... things.

Re: Illogical Logic Flow

2009-06-01 09:06 • by Dinnerbone
266505 in reply to 266502
Drew:
DO NOT REMOVE THIS COMMENT!
The Daily WTF is skipping the Real WTF without it.
Very weird.


'*******************************************************
'***** DO NOT REMOVE THE APOSTROPHE AND STARS *****
'***** Program will not compile without them *****
'***** Very weird. *****
'*******************************************************

Edit: Fail :(

Re: Illogical Logic Flow

2009-06-01 09:06 • by Raw (unregistered)
I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

So, there is a WTF, but it's not the programmer, it's Microsoft.

Re: Illogical Logic Flow

2009-06-01 09:11 • by Flipper (unregistered)
266507 in reply to 266506
Raw:
I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.

So, there is a WTF, but it's not the programmer, it's Microsoft.

No, the WTF is the programmer, who has heard at least 17,000 times that Microsoft == WTF^WTF^2, but continues to use it. And some don't even stop there, working hard to staunchly defend the sloppiest crud in the known universe.

Re: Illogical Logic Flow

2009-06-01 09:11 • by snoofle
That's not so bad... inexperienced programmer.

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


After that one, we learned to look for the telltale comment-with-semicolon and then scanned backwards.

For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).

Re: Illogical Logic Flow

2009-06-01 09:14 • by chadsexington
266509 in reply to 266508
snoofle:
That's not so bad... inexperienced programmer.

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


I think I just found my new programming style.

Re: Illogical Logic Flow

2009-06-01 09:15 • by Bob (unregistered)
266510 in reply to 266508
snoofle:

++ it could easily */x++/** mislead you into making ++

Awesome! I'm going to start using that.

Re: Illogical Logic Flow

2009-06-01 09:15 • by T $
266511 in reply to 266506
Raw:
I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.


I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.

Re: Illogical Logic Flow

2009-06-01 09:16 • by Voodoo Coder
266512 in reply to 266503
sponk:
That's a bit of a mild wtf. Someone isn't very good at programming. Oh no.
At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.


Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

Re: Illogical Logic Flow

2009-06-01 09:24 • by Raw (unregistered)
266513 in reply to 266507
No, the WTF is the programmer, who has heard at least 17,000 times that Microsoft == WTF^WTF^2, but continues to use it.


Well, in most workplaces, you really don't get the option to pick your favourite language.

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


Now, that's why you use an editor which color-codes the code, and set it to display comments with another background color.

I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.


Now, this was a decade ago, so my memory is kind of blurry, but when I got it, I got it in a nested if, which meant that it skipped to the wrong endif, and the error occured later. Took me a while to hunt it down, and a lot of swearing to try to find out WTF happened and why.

Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.


Unless you have a way overdue deadline. Then you just ship it and check it out later.

Re: Illogical Logic Flow

2009-06-01 09:26 • by Frzr (unregistered)
266514 in reply to 266508
int fancy_check(int *x, int *y)
{
if (*y==0 /* can't work with y=0 */
|| *x/*y==*y /* can't work on squares */
|| *x==3) /* I hate the number three */
return 0;
else return 1;
}

int main(int argc, char *argv[])
{
int x,y;
x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
return 0;
}

Re: Illogical Logic Flow

2009-06-01 09:27 • by SomeGuy (unregistered)
266515 in reply to 266513
Raw:

Unless you have a way overdue deadline. Then you just ship it and check it out later.


How often does checking it out later actually happen?

Re: Illogical Logic Flow

2009-06-01 09:28 • by No one of importance (unregistered)
266516 in reply to 266512
Have a look at the principles of job-extension methodology: "How to Write Unmaintainable Code,"

http://freeworld.thc.org/root/phun/unmaintain.html

Re: Illogical Logic Flow

2009-06-01 09:35 • by Matt (unregistered)
266517 in reply to 266511
I'll second it... I remember running into the problem as well. Not sure which version of VB as I dealt with VB3-->VB6 but the problem definately existed. Totally weird, could have been the compiler or IDE, but they still had less bugs and crashes than Visual Studio 2008 SP1.

Re: Illogical Logic Flow

2009-06-01 09:44 • by Raw (unregistered)
266518 in reply to 266515
SomeGuy:
How often does checking it out later actually happen?


Every time it later blows up unexpectedly.

That's the problem when the boss isn't a programmer, "it works at the moment" is good enough for the boss.

Re: Illogical Logic Flow

2009-06-01 09:52 • by brazzy
How exactly does writing software that can be consistent sold for enough money to keep a company running NOT constitute "real-world experience"??

If anything, it's people who don't consider stupid cargo cult programming to be absolutely normal and something you have to expect and deal with who are lacking "real-world experience".

Re: Illogical Logic Flow

2009-06-01 09:53 • by TRWTF (unregistered)
266521 in reply to 266509
chadsexington:
snoofle:
That's not so bad... inexperienced programmer.

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


I think I just found my new programming style.


And you have not submitted this as a story because...? Hell, just spill it here in the comments. Everyone knows the coder based WTF gets less than half the views of the blue bar stories anyway.

Re: Illogical Logic Flow

2009-06-01 09:56 • by snoofle
266522 in reply to 266513
Raw:

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


Now, that's why you use an editor which color-codes the code, and set it to display comments with another background color.

Today, yes. But that happened before the days of IDEs. You had two windows: vi and the debugger, and all the debugger showed was (pseudo)

sto x,1
inc x
whatever-came-next

Then you looked at the code window and had to find it in the jumble of comments.

Re: Illogical Logic Flow

2009-06-01 10:03 • by ricecake (unregistered)
266523 in reply to 266516
No one of importance:
Have a look at the principles of job-extension methodology: "How to Write Unmaintainable Code,"

http://freeworld.thc.org/root/phun/unmaintain.html
Here's the updated version:
http://mindprod.com/jgloss/unmain.html

Re: Illogical Logic Flow

2009-06-01 10:09 • by snoofle
266524 in reply to 266521
TRWTF:

And you have not submitted this as a story because...? Hell, just spill it here in the comments. Everyone knows the coder based WTF gets less than half the views of the blue bar stories anyway.

Sorry, I didn't think it was a WTF so much as an infantile fool throwing a tantrum.

Re: Illogical Logic Flow

2009-06-01 10:10 • by PT (unregistered)
I've worked on VB3 code way back when, where the developer actually showed me that removing a comment caused the app to shut down when it was to be executed. it was making a lot of calls to C code, and for somereason that one method needed:

'do not delete this comment, or try a compile wihtout it beforechecking in to sourcesafe

Re: Illogical Logic Flow

2009-06-01 10:17 • by Code Dependent
266526 in reply to 266522
snoofle:
Today, yes. But that happened before the days of IDEs. You had two windows: vi and the debugger
This is VB we're talking about. At my first professional coding job, I assumed we would be using C++, but was told that the company used VB for rapid application development. VB4 was just being released at that time, and I had to do a quick ramp-up with it. As I recall, the IDE displayed comments in a different color by that time.

Addendum (2009-06-01 10:27):
Oops... my mistake; sorry. Note to self: read more carefully next time.

Re: Illogical Logic Flow

2009-06-01 10:24 • by ubersoldat
266527 in reply to 266508
snoofle:
For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).


Another reason to use CVS and the email on commit plugin. If I ever see a comment like this I'll give you gummy bears to play while you wait for your FIRED email.

Re: Illogical Logic Flow

2009-06-01 10:54 • by Zarkonnen (unregistered)
266529 in reply to 266509
Literate programming?

*ducks*

Re: Illogical Logic Flow

2009-06-01 11:05 • by Shinobu (unregistered)
I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky. Although I've found some weird things, on the whole I must say that it's very robust, especially considering that a) it's 2009 now and it still works with all the new things I throw at it even though it came out in 1995 or so and b) that I'm a bloody code contortionist who likes to do strange low-level things for a hobby.

Re: Illogical Logic Flow

2009-06-01 11:13 • by Code Dependent
266532 in reply to 266531
Shinobu:
I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky.
I liked the IDE for VB4, with its arrangement of individual windows. The next version, VB97, started using the MDI and child windows, and it's been that way ever since. But I don't get using VB4. If you don't want to go to .Net, why not at least move up to VB6?

Re: Illogical Logic Flow

2009-06-01 11:16 • by Steve (unregistered)
Reminds me of a time when someone left a comment in the code about how the error handling sucked (VB 6).

There was a follow-up comment from my supervisor. Something along the lines of "what kind of an a-hole would leave a comment complaining about the error-handling without bothering to fix it? come and discuss this with me if you have the guts."

Re: Illogical Logic Flow

2009-06-01 11:23 • by Monkios
As expected, this is a comment as expected.

Re: Illogical Logic Flow

2009-06-01 11:40 • by Old fart (unregistered)
It may be related to a known bug in VB6 that occurs if an in-line If statement is nested in an If / End If block, e.g.:

If blnCondition1 then
If blnCondition2 then (do something here on this line
Else
(do something else here)
End If

The nested If must be accompanied with a corresponding End If to avoid the bug. Don't know how this got past the QA when VB6 was released

Re: Illogical Logic Flow

2009-06-01 11:50 • by aristos_achaion (unregistered)
266537 in reply to 266512
Voodoo Coder:
sponk:
That's a bit of a mild wtf. Someone isn't very good at programming. Oh no.
At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.


Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

Usually there's some kind of hubris or massive ineptitude forming the core of the WTF...in this case, it's mild inexperience and laziness. Evidently, it didn't work without the Else, so he put one in, and commented his change.

Re: Illogical Logic Flow

2009-06-01 11:52 • by aristos_achaion (unregistered)
266538 in reply to 266532
Code Dependent:
Shinobu:
I still use VB4 today. The main reason is that the IDE is up within seconds, so very nice if I want to hack up a quicky.
I liked the IDE for VB4, with its arrangement of individual windows. The next version, VB97, started using the MDI and child windows, and it's been that way ever since. But I don't get using VB4. If you don't want to go to .Net, why not at least move up to VB6?

Personally, I don't get using VB, or Windows for that matter. But different strokes for different folks, I guess.

Re: Illogical Logic Flow

2009-06-01 11:53 • by Satanicpuppy
266539 in reply to 266508
snoofle:
That's not so bad... inexperienced programmer.

I once spent a lot of time trying to figure out why "x" was incrementing in something (I inherited) like this:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


After that one, we learned to look for the telltale comment-with-semicolon and then scanned backwards.

For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).


Hah, that's amusing. I spend a lot of my time undoing that sort of sabotage, and that's really an amateurish way of doing it...Though it is somewhat clever, anyone who looked at it would immediately know that that was intentional obfuscation.

It's a lot easier to just move stuff around weirdly, and use a lot of duplicate filenames/variable names and crap like that.

Re: Illogical Logic Flow

2009-06-01 11:57 • by Zer0 (unregistered)
266540 in reply to 266503
sponk:
That's a bit of a mild wtf. Someone isn't very good at programming. Oh no.
At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.


Uh, if you've ever done that yourself, get out of this industry. I really don't ever want to run across and fix our code. Thanks =)

Re: Illogical Logic Flow

2009-06-01 12:04 • by Ray (unregistered)
266543 in reply to 266514
Frzr:
int fancy_check(int *x, int *y)
{
if (*y==0 /* can't work with y=0 */
|| *x/*y==*y /* can't work on squares */
|| *x==3) /* I hate the number three */
return 0;
else return 1;
}

int main(int argc, char *argv[])
{
int x,y;
x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
return 0;
}


Color highlighting shows the mistake right away.
Nice try. :)

Re: Illogical Logic Flow

2009-06-01 12:06 • by Jasmine (unregistered)
266544 in reply to 266537
aristos_achaion:
Voodoo Coder:
sponk:
That's a bit of a mild wtf. Someone isn't very good at programming. Oh no.
At least they tried to figure out and fix whatever was going wrong, even if they didn't understand it.


Isn't that kind of, the essence of TDWTF? People who are not very good at programming?

Cargo Cult Programming is never anything other than a WTF. If you don't know WHY something works, find out.

Usually there's some kind of hubris or massive ineptitude forming the core of the WTF...in this case, it's mild inexperience and laziness. Evidently, it didn't work without the Else, so he put one in, and commented his change.


They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.

Re: Illogical Logic Flow

2009-06-01 12:23 • by pitchingchris
266545 in reply to 266544
Jasmine:

They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.


How is it a WTF that it did work without the else ? There isn't any code in the else to do anything, so it would perform the same way in both cases.

Its kind of lame wtf today, it just looks like some comments that somebody new to debugging probably put in there. Even though its senseless and should be removed, its just the mark of a beginner. It has no real affect, as already mentioned. The main issue is that debugging comments made it into source control (if one is used). These should be reviewed before committing.

Re: Illogical Logic Flow

2009-06-01 12:31 • by Leak
266549 in reply to 266536
Old fart:
It may be related to a known bug in VB6 that occurs if an in-line If statement is nested in an If / End If block, e.g.:

If blnCondition1 then
If blnCondition2 then (do something here on this line
Else
(do something else here)
End If

The nested If must be accompanied with a corresponding End If to avoid the bug. Don't know how this got past the QA when VB6 was released

That looks more like a dangling else to me...

np: The Wooden Birds - False Alarm (Magnolia)

Re: Illogical Logic Flow

2009-06-01 12:37 • by Jasmine (unregistered)
266552 in reply to 266545
pitchingchris:
Jasmine:

They did what needed to be done to make it work, and it's hard to disagree with that. The RWTF is how often that happens and is never re-visited for improvement - and the fact that it did work without the else.


How is it a WTF that it did work without the else ? There isn't any code in the else to do anything, so it would perform the same way in both cases.

Its kind of lame wtf today, it just looks like some comments that somebody new to debugging probably put in there. Even though its senseless and should be removed, its just the mark of a beginner. It has no real affect, as already mentioned. The main issue is that debugging comments made it into source control (if one is used). These should be reviewed before committing.


I just think it's suspicious that someone obviously had a problem without putting the else, and then someone else later on had it work fine. I've been doing this stuff for 25 years, and I've seen this kind of thing a few times, and the one reasonable explanation for it has been updates to the compilers/interpreters between the first and second revisions. When you can't find an explanation like that, it is just suspicious and you go with it. In business you do whatever it takes to get the job done, and if you don't understand it, then you're welcome to have a bad feeling about that, but you're going to do it anyway. I vaguely recall VB doing this kind of thing - it would cause a runtime error.

This is definitely a WTF - but you see this kind of thing occasionally. I've seen perfect code maybe once in my life - and I wrote it, in college - which is the only place perfect coding happens on a regular basis.

Re: Illogical Logic Flow

2009-06-01 12:38 • by jacmoe (unregistered)
I really don't think it's a WTF.
It was a bug in VB, so they worked around it.
And because they didn't want to look stupid, or someone removing the empty else statement, they wrote a comment. A WTF comment, but a comment none the less. :)

Re: Illogical Logic Flow

2009-06-01 12:43 • by Kluge Doctor (unregistered)
266555 in reply to 266508
snoofle:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;





int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++;/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


Fixed.

Re: Illogical Logic Flow

2009-06-01 12:45 • by Been there done that (unregistered)
266557 in reply to 266553
This was a rare bug in VB3 during 1993-1994 and was fixed in VB4 by 1995. The workaround was as described int eh original code above.

Re: Illogical Logic Flow

2009-06-01 12:54 • by Redundant Semicolon (unregistered)
266560 in reply to 266555
Kluge Doctor:
snoofle:


int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;





int x = 1;
/**++++++++++++++++++++++++++++++++++++++++++++++++++++
++ This is a long comment of a lot of text that ++
++ had absolutely no redeeming value except that ++
++ it could easily */x++;/** mislead you into making ++
++ your eye skip right past the relevant part in ++
++ the middle of the block of unending comments. ++
++++++++++++++++++++++++++++++++++++++++++++++++++++*/;


Fixed.


You shouldn't fix what is not broken :)

Re: Illogical Logic Flow

2009-06-01 12:55 • by aggle-rithm (unregistered)
266562 in reply to 266508
snoofle:

For those who care, the guy was indeed sabotaging the code, and was fired 3 weeks later (big corp, wheels grind slowly).


"I swear to God, if you sabotage any more code, I will start the disciplinary process!!!"

Re: Illogical Logic Flow

2009-06-01 13:18 • by jmroth
Probably the 'End If' was on the same line as one of the comment lines :P
To make it worse, line wrapping probably put the 'End If' at the beginning of a line :P

Re: Illogical Logic Flow

2009-06-01 13:22 • by Pim
266569 in reply to 266543
Ray:
Frzr:
int fancy_check(int *x, int *y)
{
if (*y==0 /* can't work with y=0 */
|| *x/*y==*y /* can't work on squares */
|| *x==3) /* I hate the number three */
return 0;
else return 1;
}

int main(int argc, char *argv[])
{
int x,y;
x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
return 0;
}


Color highlighting shows the mistake right away.
Nice try. :)
Color highlighting? You mean you actually had to paste that into an IDE before you could see it?
:: giggles ::

Re: Illogical Logic Flow

2009-06-01 13:31 • by SomeCoder (unregistered)
266571 in reply to 266543
Ray:
Frzr:
int fancy_check(int *x, int *y)
{
if (*y==0 /* can't work with y=0 */
|| *x/*y==*y /* can't work on squares */
|| *x==3) /* I hate the number three */
return 0;
else return 1;
}

int main(int argc, char *argv[])
{
int x,y;
x=0; y=1; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
x=9; y=3; printf("%d,%d -> %d\n", x,y,fancy_check(&x,&y));
return 0;
}


Color highlighting shows the mistake right away.
Nice try. :)


This is exactly why I it when people format their code that way. What is wrong with adding spaces in there:

if (*x / *y)

rather than

if (*x/*y)

which not only doesn't work but looks bad anyway.

Oh well :)

Re: Illogical Logic Flow

2009-06-01 13:45 • by Code Dependent
266573 in reply to 266538
aristos_achaion:
Personally, I don't get using VB, or Windows for that matter. But different strokes for different folks, I guess.
As has often been pointed out here, and even by me in an earlier post in this thread, you don't always get to choose your OS or programming language. Especially in a town of population 85,000, where you will be lucky if there are a dozen programming positions in the whole town, nevermind you actually getting hired for one of them (which happens when somebody dies or moves away).

Re: Illogical Logic Flow

2009-06-01 13:50 • by Americium (unregistered)
266574 in reply to 266511
T $:
Raw:
I've seen that problem happen occasionally in some older VB version (probably VB4, it was buggy as hell). I never managed to figure out the logic behind it, but it certainly did happen, and the solution was to put an empty Else clause.


I can believe it. I'm curious though, would this mean that the compiler bounces back an error without it, the program would issue a runtime exception, or is it executing everything past the end if only if the condition is true.


I just discovered a similar bug in Python. Prior to version 2.5, The finally block couldn't exist without an except (same as catch).

try:
f = open('./file.txt')
# ...
# Error in Py2.4- due to no except:
finally:
f.close()

These are both parser design flaws. if without else and try without except are probably difficult cases. See the topic if-statement dangling-else on compilers.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment