It always worked well before so leave it like that... [modified]
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
I had to stare at that for a good 30 seconds before I spotted the bug. Gosh - I need a decent compiler at this time in the morning to help me!
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
Ok, it took me a while to see the ";" after the first "if". You would have done me a great favor by simply mentioning that in your message. It's funny! I just wanted to say that I know what you mean. I'm stuck with something similar. Lots of code doing nothing. I can't believe you actually took the time to count the lines of code! :) All I can say is that the program I have to work on has about 30000 files of source organized in about 2000 folders. So, if there were about 400 lines of code per file, that would make a total of 12 million lines of code! However, that's an understatement, since most files have more than 400 lines of code. When I run into errors like this I think a lot about whether I should fix them or not, since doing so might actually be causing a bug. :)) I took up assembly language a long time ago, just because of this. C++ and all other high level programming languages are supposed to be related a great deal to human language. But people say stupid things all the time. :)
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
Real nasty ones these; you just read straight over the problem and not notice it 9 times out of 10.
Steve
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
This is a good candidate for the Subtle bugs forum.
Deja View - the feeling that you've seen this post before.
-
This is a good candidate for the Subtle bugs forum.
Deja View - the feeling that you've seen this post before.
Not if they determined "it's not a bug".:-D
-
Not if they determined "it's not a bug".:-D
And believe what? For them, it wasn't a bug, since it always worked "well" before! At first, they tought it was a typing mistake made accidentaly by me until they looked into SourceSafe and agreed that the mistake was there too, since a couple of years before! Progamming looks like taking drugs... I think I did an overdose. ;-P
-
This is a good candidate for the Subtle bugs forum.
Deja View - the feeling that you've seen this post before.
Yeah, definitively!
Progamming looks like taking drugs... I think I did an overdose. ;-P
-
Ok, it took me a while to see the ";" after the first "if". You would have done me a great favor by simply mentioning that in your message. It's funny! I just wanted to say that I know what you mean. I'm stuck with something similar. Lots of code doing nothing. I can't believe you actually took the time to count the lines of code! :) All I can say is that the program I have to work on has about 30000 files of source organized in about 2000 folders. So, if there were about 400 lines of code per file, that would make a total of 12 million lines of code! However, that's an understatement, since most files have more than 400 lines of code. When I run into errors like this I think a lot about whether I should fix them or not, since doing so might actually be causing a bug. :)) I took up assembly language a long time ago, just because of this. C++ and all other high level programming languages are supposed to be related a great deal to human language. But people say stupid things all the time. :)
Since it took you a while, you can imagine how funny it was to me to find it. I just wanted you to go trough what I had to. And since us programmer are supposed to be more "logical" :-D than everyone else, I thought I was not mandatory to point where the bug was. :) For the time needed to count the lines of code, I didn't have to take this time, because they had already counted it and was proud of the count. :confused: They were trying to beat 4 millions lines of code. It was a goal for them! Guess why I quit the company a couple of weeks after!! :(( I agree with you that fixing the error may cause a bug. It's one of the answer they gave me too. Cheers, Stephan
Progamming looks like taking drugs... I think I did an overdose. ;-P
-
I had to stare at that for a good 30 seconds before I spotted the bug. Gosh - I need a decent compiler at this time in the morning to help me!
I have Coffee Compiler 3.2 and Double Expresso Linker 4.3 to help me every morning. :-D Sometimes, when Headache 1.4 (the infinite loop manager) seems to be apparent in action, I use the debugger Aspirin 3.3 to help me. :doh: Have a nice day! :-D Stephan
Progamming looks like taking drugs... I think I did an overdose. ;-P
-
Yeah, definitively!
Progamming looks like taking drugs... I think I did an overdose. ;-P
;P I overdosed a long time ago… X|
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
-
;P I overdosed a long time ago… X|
INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
I'm in detoxification right now. Should be able to get hooked again in a few months... :doh:
Progamming looks like taking drugs... I think I did an overdose. ;-P
-
A couple of year ago, I worked for a compagny who were making vision sensing application for wood machinery. Their code (in C++) was a lot complicated, with lots of subclassing, and for the worst part of it, almost every options parameters controlling the code sequence were implemented with #if #then to "save some processor time". (The main core of the program was developped in Turbo-Dos like 15 years ago, then ported to Visual 6.0. It's why they used those #if #then...) The code was more than 3 millions line of code!!! That's it for the introduction. (You may already laugh!!) But one day, I came across a fonction used to connect a RS232 port. This is the interesting part inside the fonction : ...some code here if( strcmp( lpszPortName, "COM1") == 0 ); { // Connect the COM1 port ...some code here } else if( strcmp( lpszPortName, "COM2") == 0 ) { // Connect the COM2 port ...some code here } else ... So I asked one of the guy who were working there since a very long time, why they didn't corrected that error... He told me "It always worked well before, and the compiler never notified any error so leave it like that..." Do you know why I found this little error in 3 millions of code lines? Because this sequence was part of a library used in the main program, and because that library had never been recompiled since its first release 10 years before! For some reasons, I just forgot to follow a little "office rule" that was to never recompile all projects in a workspace in a single shot. I did it "oh unfortunately" then the compiler hit that error immediately!! Progamming looks like taking drugs... I think I did an overdose. ;-P -- modified at 3:09 Tuesday 13th March, 2007
well, it did not take me even a minute to spot that. i caught the error as soon as i read that there was an error in the code. :)
Regards, Vijay. God may not give us what we 'want', but he surely gives us what we 'need'.