This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

good code bad answer

my code is 110% correct; eg no errors and runs properly. see.

int _val;

int myfunc2(int val)
{
  _val = val;
   return _val;
};

int Bar(int val)
{
  return _val + val + 1;
};

void myfunc1(int val)
{
  _val += Bar(val);
};

etc
etc
etc

it doesnt give me the right answer sometime.

HEEEEEEEELLLLLLLPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

Parents
  • "Then mine happened to be the project where all the external conditions (speed of CPU, speed of peripheral device, etc.) were just right to trip the lurking bug."
    I am not convinced that it is a bug.

    Well, I am - unless the "speed of CPU, speed of peripheral device etc." was in combination with code reuse on anoter processor. I have had cases where a bug only showed its ugly face when a peripheral within specs ran slow.

    I think it is practically impossible to write completely bug-free code that works under all circumstances.
    maybe, but not an excuse

    Instead, we all write code pieces that have "limitations" that unravel under certain conditions. it is our job to document such limitations so that when we are in a circumstance where the limitations become reality, we know that we need to fix the code for that particular application.
    this is either total BS or something that refer to reusability of code.

    Erik

Reply
  • "Then mine happened to be the project where all the external conditions (speed of CPU, speed of peripheral device, etc.) were just right to trip the lurking bug."
    I am not convinced that it is a bug.

    Well, I am - unless the "speed of CPU, speed of peripheral device etc." was in combination with code reuse on anoter processor. I have had cases where a bug only showed its ugly face when a peripheral within specs ran slow.

    I think it is practically impossible to write completely bug-free code that works under all circumstances.
    maybe, but not an excuse

    Instead, we all write code pieces that have "limitations" that unravel under certain conditions. it is our job to document such limitations so that when we are in a circumstance where the limitations become reality, we know that we need to fix the code for that particular application.
    this is either total BS or something that refer to reusability of code.

    Erik

Children