My mea culpa:

I had designed an C API where most of the functions were supposed to return 0 for "all is well" and an error code if something is wrong. This is a standard return value pattern for C.

One of our team members went on vacation. His code was a "mess" so I thought I'd clean it up a bit. He came back a few days later. About that time, a big chunk of the API that had been coded and tested stopped working. We couldn't figure out what could possibly be the problem. Since I was the lead and we were really stuck, I went through the code looking for a bug. After laborously tracing code (this was back in the days of character monitors - VT-100 I think) I discovered that the bug was ... mine.

Turns out that the programmer thought 0=OK, !0=problem was too confusing. 0=false and 1=true right? So within the code that was hidden from the public interface he'd gone by his own conventions and had successful functions return 1 and failed functions return 0. When I had "fixed" the code to match convention, I broke it because I didn't realize that his returning 1 where I expected 0 was by intent. We lost three days.

Lessons learned?


In reply to Re: PM Confessional by ELISHEVA
in thread PM Confessional by thezip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.