Hi Alex,

At 2025-09-17T14:44:23+0200, Alejandro Colomar wrote:
> Ping.
> 
> I'm also working on having some other APIs added to gnulib, so I'll
> send more patches eventually (once they do the next stable release,
> with these new APIs).

I have to admit I haven't put a priority on this, due to a few factors.

1.  No exogenous factor is pressing to bump our gnulib submodule to the
    2025-07 stable tag.  However, that tag _is_ almost three months old,
    and I can't delay forever because gnulib releases/tags have a
    lifespan of only 1 year.

2.  My impression is that `countof()` is available only in that stable
    tag, not the 2025-01 one we're currently on.  (I have been very lazy
    here, and not looked.)

3.  Within the past few months I refactored some of the same code you're
    touching in this patch to more consistently use our bespoke
    `array_length()` solution to this problem.[1]

4.  I'm trying to fry release-critical fish.  Assuming Deri doesn't find
    a problem with my overhauled and heavily unit-tested refactoring of
    "asciification"[2][3]--which, knock wood, will make hyperlink text
    construction and PDF bookmarking much easier in _any_ macro
    package--then I need to sort out the problem of underspecified
    delimiter semantics.[4][5]  CSTR #54 kind of whistled past the
    graveyard here;[6] zombies have finally erupted to stalk the night.

I'm not _opposed_ to migrating to `countof()`; it simply seems to me
a relatively cutting-edge modernization that brings little practical
benefit.

Maybe this patch series should be updated and filed as a bug so this
refactoring doesn't get forgotten.  Maybe bug #66518 could depend on it.

Regards,
Branden

[1] $ git log --grep=sizeof

commit 55739bcce7ea8378e90f724d3561ea2ed3d50d40
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Fri Jul 11 06:57:26 2025 -0500

    [addftinfo]: Fix code style nits.

    * src/utils/addftinfo/addftinfo.cpp: Give the anonymous `struct` type
      used for `param_table` a name, `parameter`, so it can be passed to a
      template function C++98-conformantly.

      (main): Use `array_length()` on `param_table` instead of `sizeof` and
      division.

commit 88870ab4242942a862d18d833b16315f9847f046
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Fri Jul 11 06:10:48 2025 -0500

    [preconv]: Fix code style nits (1/6).

    * src/preproc/preconv/preconv.cpp (get_BOM): Give the anonymous `struct`
      type used for `BOM_table` a name, and move it into the global scope
      (it was already `static`), so that it can be passed to a template
      function C++98-conformantly.  Use `array_length()` on `BOM_table`
      instead of `sizeof` and division.

commit 413611e7187112fed68ab04f30158c716b7425c5
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Fri Jul 11 05:41:01 2025 -0500

    [eqn]: Fix code style nits.

    * src/preproc/eqn/lex.cpp: Sort libgroff header files before
      program-specific ones.  Give the anonymous `struct` type used for
      `token_table` a name, so that it can be passed to a template function
      C++98-conformantly.

      (init_table): Use `array_length()` on `token_table`, `common_defs`,
      `troff_defs`, and `mathml_defs` instead of `sizeof` and division.

commit 293222cffd76244a20c98d54e0ff68d6bd3ecbef
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Fri Jul 11 05:32:34 2025 -0500

    src/libs/libgroff/font.cpp: Fix code style nits.

    * src/libs/libgroff/font.cpp: Give the anonymous `struct` type used for
      `table` a name, so that it can be passed to a template function
      C++98-conformantly.  Give `table` a better name:
      `numeric_directive_table`.  Now that their enclosures have better
      names, give the `numeric_directive` `struct` element
      `numeric_directive` the better name `name`.

      (font::load_desc): Track renames.  Use a `size_t` as the loop index.
      Parenthesize (formally) complex pexpressions.  Use `array_length()` on
      `numeric_directive_table` instead of `sizeof` and division.

commit da19f50f9188014b8cb3cd9374fd0d88154df37d
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Thu Jul 10 21:52:19 2025 -0500

    [grolj4]: Fix code style nits.

    * src/devices/grolj4/lj4.cpp: Give the anonymous `struct` type used for
      `paper_table` a name, so that it can be passed to a template function
      C++98-conformantly.

      (lookup_paper_size): Use a (signed) `int` as the loop index, which
      happens to conform with the signedness of the function's return value
      as which it can be used.  Use `array_length()` on `paper_table`
      instead of `sizeof` and division.

commit e1754323e51ea7987d75297958769bc4bb5019f3
Author: G. Branden Robinson <g.branden.robin...@gmail.com>
Date:   Thu Jul 10 21:43:27 2025 -0500

    [grolbp]: Fix code style nits.

    * src/devices/grolbp/lbp.cpp: Give the anonymous `struct` type used for
      `lbp_papersizes` a name, so that it can be passed to a template
      function C++98-conformantly.

      (set_papersize): Use `array_length()` on `lbp_papersizes` instead of
      `sizeof` and division.

      (wp54charset, lbp_printer::vdmflush): `sizeof` is an operator, not a
      function, so don't parenthesize its operand when it's an lvalue (as
      opposed to a type name).

[2] https://savannah.gnu.org/bugs/?66653
[3] https://savannah.gnu.org/bugs/?67532
[4] https://savannah.gnu.org/bugs/?67372
[5] https://savannah.gnu.org/bugs/?67408

[6] If you tilt your head just right, you can figure out from its text
    that there are three contexts for delimited parameters in AT&T
    troff.

    1.  (potentially) numerical expressions (§5.2)
    2.  ("dumb") string expressions (§14)
    3.  conditional expressions (§16)

    In AT&T troff, the sets of characters that are valid in each case
    are partially disjunct from the others.

Attachment: signature.asc
Description: PGP signature

Reply via email to