"edata" the hidden Microsoft variable
-
Now this was a ways back, when DOS was the ruler and the Microsoft C compiler came on 5 1/4" floppies. These are the details as I remember them. We had a data acquisition application that used a data array called "edata". In one particular function where we had traced the bug, you could see that at the start of the fuction all was right with the data in the "edata" array. By the end of the function the data was corrupt. Should be a an easy find, right? The debugger clearly showed that that a call to sprintf() was the culprite. Again should be an easy find. We were not using "edata" in the call to sprintf() so it must have been a string overwrite into the "edata" variable. Two man weeks later we noticed in the LST files that sprintf() made reference to a variable called "edata". Apparently we had accidently stumbled across an undocumented Microsoft variable whose name space was mixed up with our own "edata". The fix? Changed our variable's name from "edata" to "afltEvenlySpacedData" and all was right with the world again. Since then I have never shortened a name for a variable even when my most famous variable became "pchGodOnlyKnows" (some bit flag in the nether regions that allowed me to change the read/write sector size for floppy disk IO functions, but I could never could find a document that said what exactly it was).