Why is this global declared...
That surprisingly is the first thing that popped into my head after reading this worse than failure entry...
You might ask "why". Well, it made me remember this conversation I had with a developer about 15 or 16 years ago:
me: Why is this global declared - it isn't used.
them: because if you remove it, the program will crash.
me: you mean it won't compile because it really is used?
them: no, it compiles cleanly with or without it - but there must be a bug in the compiler because if you remove the global variable - the program segmentation faults and dumps core
me: do you understand what you have really done here? You have a memory overwrite and you are just hiding it by having this big variable stuck in there - you have a bug in your code.
them: how could it be a bug in my code, my code runs - as long as the variable is defined. it must be the compiler.
It was not a good day :) We spent the rest of the week removing unused globals and local stack variables - fixing memory overwrite after memory overwrite in the process. They really blamed the compiler.
I miss my old C programming days, they were fun (really)...


15 Comments:
remind me to tell you the story of how i learned to code C.;-)
Typical. Here at my current employer, there's a programmer (considered to be a power programmer) who, whenever the program doesn't work, blames it on the database. When told that the program was missing error handling, etc, would looked at you as if you are from another planet.
Ahh, the good old days of C programming....;-)
My favorite was the bug that would disappear when you recompiled the program w/ debug turned on.....;-)
Hmm, a blog entry but no followups on asktom two days running: dare I hope you're working on your book? Any chance of getting a teensy weensy hint on how it's coming along?
Tom I have a question for you... I am by no means knowledgeable with oracle but I am having trouble understanding what is going on ...We have an Oracle database at work Version 7 I belive and we have been using Microsoft Access 97 with it for years to run reports and all sorts of neat things... recently we changed to Access 2003... Lately I've been asked to relink alot of the Access Databases and compress them because Our Oracle Admin here says that the Server is peaking out... the # of Processors in use at one time has jumped from 3 to 4 to 6 I belive and that it is acting really slow... and response times are awful at times... Is there anything you have seen in your experience that might be of hand to me in looking at Access or for that matter any database that is connecting to Oracle that could be causing problems...
I think this is why Java was invented. Too many people were too dumb for C.
...Too many people were too dumb for C....
No, I don't like the way that is stated.
They are not, were not too dumb. They were just not educated.
And trust me - Java gives you INFINITELY more exciting ways to shoot yourself in the foot without realizing it. Simply because so much "just happens as a side effect of something else"
If anything, I would say writing correct code in Java is more complex and tricky than C.
Mette says:
I think it was the other way round. That Java/c were too stupid for the programmers. Who in their right mind made Java case sensitive?? Would YOU define a variable called amount and another Amount and a third AMOUNT? No, then why on earth enable yet another possiblity for crappy programming?
Mette
PS Long live pl*sql, rexx, cobol (!!) pascal (look alikes) etc.
Well, if I might just say, Algol60 was my favourite programming language. I love SQL but can anyone forgive me - I've just been on a 5 day ABAP course!
A google for:
Gene Weingarten SAP
gives a funny column.
Its possible to get into a great deal of trouble in any programing language, I've had to work with a VB programmed who used the names bob and fred for every variable. If you need more than two variables just append a number, bob01, bob02 etc. Made debuging his code lots of fun.
If you need more than two variables just append a number, bob01, bob02 etc. Made debuging his code lots of fun.
Don't get me started, I know SO many developers who use un-named variables all the time, x, y, z, etc, or how about cursors named cur1, cur2 etc.
Don't worry about the world coming to an end today. It's already tomorrow in Australia. - Charles Schultz
Where are you Tom? May is over your sales in june dont come into play until next year Tom. Why don't you post something?
Hi Tom,
sorry nothing to do with globals BUT
haven't been able to access your site
via
http://asktom.oracle.com/pls/asktom/f?p=100:1:2226750617586127
Just get connection timed out
since Saturday 16th June
Any thoughts ?
iwg
POST A COMMENT
<< Home