Slashdot Mirror


User: ame12

ame12's activity in the archive.

Stories
0
Comments
3
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 3

  1. Re:BS on Open Source Programmers Stink At Error Handling · · Score: 1

    Omit the following lines from the bottom of the snippet... had to completely munge the formatting to adhere to postfilters!

    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }

  2. BS on Open Source Programmers Stink At Error Handling · · Score: 1

    here's a real simple template for C error-handling that would remove 99% of all error/unwind conditions.

    int _UpdateRecord(int argc, char **argv) {
    int bTableUnlock = false;
    int bRecordUnlock = false;
    int rc = 0; // always return an error code
    int rc1;
    do { // structure loop
    if (argv != 3) {
    rc = BAD_ARG_COUNT; break;
    }
    if (rc = TableLock(argv[0])) {
    break;
    }
    bTableUnlock = true;
    if (rc = RecordLock(atoi(argv[1])) {
    break;
    }
    if (rc = RecordModify(argv[2])) {
    break;
    }
    // done with structure loop
    } while (0);
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bTableUnlock) {
    if ((rc1 = TableUnlock(argv[0])) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    if (bRecordUnlock) {
    if ((rc1 = RecordUnlock(atoi(argv[1]))) != 0 && !rc) {
    rc = rc1;
    }
    }
    return (rc);
    }

    The "do { ... } while (0);" construct gives the 'try/catch' effect with no overhead and permits easy cleanup/unwind code.

    If C developers adhered to this type of approach with rigor, IMO we'd have a much better track record all told.

  3. Re:P2P isn't legal, but it "can" be on EFF Seeks Examples Of Legit P2P Use · · Score: 1
    P2P not legal?

    Explain - after surfing to BadBlue (an enterprise P2P package). Specifically P2P sharing of Excel and Word data. Lots of business applications I can imagine for this - mobile/wireless etc.

    In addition, there is a white-paper on the site describing a P2P approach to B2B marketplaces. I think there a boatload of legitimate P2P applications.