🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #2125

Re: stupid cascade of errors

#2125
From: Lawrence D’Oliveiro
Date: Thu, 03 Dec 2026 06:01
98 lines
3840 bytes
On Thu, 3 Dec 2026 05:40:07 -0000 (UTC), Steven G. Kargl wrote:

> It seems that you may be looking at the issue wrong. Modern
> editors/IDE have syntax highlighting and the ability to display
> matching () and {}.

“Parenthesis pileup” is a well-known occupational hazard among Lisp
programmers. But, in any case, parenthesis clutter soon reaches the
point where it is detracting from readability, rather than adding to
it.

Another option is, the window (or page) showing your code is
two-dimensional; why not take advantage of that in the layout? The
human eye is good at spotting shapes, after all:

    if
      (
            same_pix_as != 0
        and
            (
                result->baseaddr != same_pix_as->baseaddr
            or
                result->width != same_pix_as->width
            or
                result->height != same_pix_as->height
            or
                result->stride != same_pix_as->stride
            or
                result->depth != same_pix_as->depth
            )
      )
      {
        PyErr_SetString(PyExc_ValueError, "inconsistent pixmap for
        channel");
        break;
      } /*if*/

    ...

    if
      (
            (srcchanobj[0] != Py_None) != (dstchanobj[0] != Py_None)
        or
            (srcchanobj[1] != Py_None) != (dstchanobj[1] != Py_None)
        or
            (srcchanobj[2] != Py_None) != (dstchanobj[2] != Py_None)
        or
            (srcchanobj[3] != Py_None) != (dstchanobj[3] != Py_None)
      )
      {
        PyErr_SetString
          (
            PyExc_ValueError,
            "src and dst channels must be specified/omitted in pairs"
          );
        break;
      } /*if*/

    ...

    dstpixel =
            dstpixel & ~(CPNT_MAX << dstchan[chan].shiftoffset)
        |
            val << dstchan[chan].shiftoffset;

    ...

    const pix_type srcval =
        lrintf
          (
            fmaxf
              (
                fminf
                  (
                        (srcpixel >> srcchan[chan].shiftoffset & CPNT_MAX)
                    +
                        errors[chan][0][col] * error_scale,
                    CPNT_MAX
                  ),
                0
              )
          );

    ...

    maskval =
            ((uint32_t *)maskrow)[col] >> mask.shiftoffset
        &
            maskmax;

    ...

    dstval =
                ((uint32_t *)dstrow)[col]
            &
                ~((1 << dst.bitwidth) - 1 << dst.shiftoffset)
        |
            srcval << dst.shiftoffset;
Technical Details
Message-ID: <11er0kc$3uoi3$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11epud7$3fup6$1@dont-email.me> <11eqvbn$3uj7j$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.c
Subject: Re: stupid cascade of errors
Date: Thu, 3 Dec 2026 06:01:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 98
Message-ID: <11er0kc$3uoi3$1@dont-email.me>
References: <11epud7$3fup6$1@dont-email.me> <11eqvbn$3uj7j$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 03 Dec 2026 06:01:50 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="4153923"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX181a1nnlTO6HR5RwqSmVI7I"; posting-host="29251116a02464f8799f650fd9fce863"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:QCoXkofPjVrV+ANhyA7Q5O985sk= sha256:HMV3OWeEz26bnMhbUFHUSoCstLbT3zaMvMp6vD2kbYA=
	sha1:3A87ku9tznyB40RhF9xlhk5vha0= sha256:Fr2CLMIRHx41qgXmc9ZA667hE72St/o4JYb7uwHidwo=