> Sford wiki > Sford fun > Sford index=1 story

Non-programmers may leave now, unless you like listening to old programmers' war stories.

Many years ago, I worked on an embedded project. Our normal way of handling internal errors was to call "fatal error", passing in the function name and a short description of the error. This was in a primitive language (PL/M) that didn't support varargs, so we couldn't support an arbitrary "printf" style of function. Instead, we wrote our fatal error to accept a single integer to help the programmer diagnose the problem. For example (in C, not PL/M):

   int foo(int leg_num)
   {
       if (leg_num > 2) fatal_error("foo", "bad leg num", leg_num);
   . . .

The fatal_error() function would display a line approximately of the form:

   Fatal error [foo]: bad leg num (index=3)

Not great, but it helped.

Well actually ... not so much. We would get reports from users. Those reports would usually be, "Well, it said something about 'foo' or maybe it was something else, but it definitely said, 'index equals 3.' I wrote that down!"

Oh thanks! The least-useful part of the error message is the part that users wrote down.

Sound familiar? No seriously, just how familiar does that sound? If anybody actually reads this and knows the product this was for, let me know and I'll give you $50. My email address is on my home page. Don't see it? Look again.

Retrieved from "http://wiki.geeky-boy.com/w/index.php?title=Sford_index=1_story"