Ohk I remember one, we had a product at Waayoo and me and Amit Saini were working on a nitrogen inflating machine. And Everything was setup, the machine’s embedded part was working, we had a software application written in python, to interface with the embedded part. We did that and it started working fine. But Then we need to make some changes in it, so Amit Saini sir started making changes in his side of function. so function was something like this, all we had to do was to check of the value is 0 we will initiate the system and then will change it to to 1 statically, and then that starting function will never run again. And the code goes like this -
function initiate(int check){
if(check==0){
startagaint();
check==1;
}
}
That was the code, and this function has to be called several times in the whole process, after a time we got stuck whenever this function called the second time it always keep repeating itself. and we had no idea why.
And in Amit sir’s defense the fonts were a little small and we were in little depression, so we took 8 hours checking out 2000 lines of code, looking in every function. And then we started looking in to python code, but find nothing. And after 8 hours Sir pointed out this error himself.
So if you have got the error then its ok , if not the let me reveal it that the value of check was never 1 it was always 0, and after this function another function was called which always checked if the value was 0 it called the initiate function again. When we start the machine for the first time it never checked the value of check. But after a specific situation we had to check if we need to restart.
That’s how it happened :P
Happy coding ;)
Comments
Post a Comment