• Which code style do you prefer the most?

    From Ar Rakin@21:1/5 to All on Tue Feb 25 21:15:12 2025
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk
    {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    static inline void *
    get_chunk_ptr (struct malloc_chunk *chunk)
    {
    return (void *) (chunk + 1);
    }

    void *
    malloc (size_t size)
    {
    struct malloc_chunk *chunk = mm_find_chunk (size, MM_CHUNK_FREE);

    if (chunk)
    return get_chunk_ptr (chunk);

    chunk = mm_alloc_chunk (size);

    if (!chunk)
    return NULL;

    return get_chunk_ptr (chunk);
    }

    ---------


    2. Linux Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    static inline void *get_chunk_ptr(struct malloc_chunk *chunk)
    {
    return (void *) (chunk + 1);
    }

    void *malloc(size_t size)
    {
    struct malloc_chunk *chunk = mm_find_chunk(size, MM_CHUNK_FREE);

    if (chunk)
    return get_chunk_ptr(chunk);

    chunk = mm_alloc_chunk(size);

    if (!chunk)
    return NULL;

    return get_chunk_ptr(chunk);
    }

    ---------

    3. Other Styles?

    Please show an example!

    Thank you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to David LaRue on Tue Feb 25 21:34:34 2025
    On 2/25/25 9:23 PM, David LaRue wrote:
    I used a style similar to this in school. Before that I used much the same. As for existing code bases I prefer to keep their style and add comments accordingly. That generally goes for any language.

    Agreed. For existing projects, the code style should be preserved.

    Popularity of a style shouldn't be a goal. It should be consistantly readable and documented. We must write for ourselves as well as our future self and others.

    This is true. I just wanted to know which style most people seem to prefer.

    Thanks for your response!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David LaRue@21:1/5 to Ar Rakin on Tue Feb 25 15:23:36 2025
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote in news:vpkmq0$21php$1@dont- email.me:

    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk
    {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    I used a style similar to this in school. Before that I used much the same.
    As for existing code bases I prefer to keep their style and add comments accordingly. That generally goes for any language.

    Popularity of a style shouldn't be a goal. It should be consistantly
    readable and documented. We must write for ourselves as well as our future self and others.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to David LaRue on Tue Feb 25 15:43:33 2025
    David LaRue <huey.dll@tampabay.rr.com> writes:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote in news:vpkmq0$21php$1@dont- >email.me:

    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk
    {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    I used a style similar to this in school. Before that I used much the same. >As for existing code bases I prefer to keep their style and add comments >accordingly. That generally goes for any language.

    Popularity of a style shouldn't be a goal. It should be consistantly >readable and documented. We must write for ourselves as well as our future >self and others.

    Agreed. Although I prefer 1, I'll match the existing style for
    extant codebases.

    I'll note that the soi disant "GNU" style closely mirrors
    the System V style - components of which were designed to
    work well with vi(1) and its clones.

    GNU style advantages:

    1. Starting the function name in column 1 allows simple
    searchs in vi to find the function:

    e.g. '/^get_chunk_ptr'.

    2. Starting the function brace in column 1 supports the
    vi '[[' command to move to the start of the current function,
    and ']]' to move to the start of the next function.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Ar Rakin on Tue Feb 25 16:17:30 2025
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    On 2/25/25 9:23 PM, David LaRue wrote:
    I used a style similar to this in school. Before that I used much the same. >> As for existing code bases I prefer to keep their style and add comments
    accordingly. That generally goes for any language.

    Agreed. For existing projects, the code style should be preserved.

    Popularity of a style shouldn't be a goal. It should be consistantly
    readable and documented. We must write for ourselves as well as our future >> self and others.

    This is true. I just wanted to know which style most people seem to prefer.

    Thanks for your response!

    I prefer the AT&T style (which you call GNU style, but which actually
    predates Stallman).

    The vi(1) editor has several commands that are designed to support
    the AT*T (or more properly, Bell Labs) style, such as the '[['
    and ']]' commands. Starting a function definition with
    the function name in column 1 enables the use of the VI

    /^main

    command to easily move the cursor to the start of a named function.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to Scott Lurndal on Tue Feb 25 22:50:34 2025
    On 2/25/25 10:17 PM, Scott Lurndal wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    On 2/25/25 9:23 PM, David LaRue wrote:
    I used a style similar to this in school. Before that I used much the same.
    As for existing code bases I prefer to keep their style and add comments >>> accordingly. That generally goes for any language.

    Agreed. For existing projects, the code style should be preserved.

    Popularity of a style shouldn't be a goal. It should be consistantly
    readable and documented. We must write for ourselves as well as our future >>> self and others.

    This is true. I just wanted to know which style most people seem to prefer. >>
    Thanks for your response!

    I prefer the AT&T style (which you call GNU style, but which actually predates Stallman).

    The vi(1) editor has several commands that are designed to support
    the AT*T (or more properly, Bell Labs) style, such as the '[['
    and ']]' commands. Starting a function definition with
    the function name in column 1 enables the use of the VI

    /^main

    command to easily move the cursor to the start of a named function.


    Interesting to know! The only time I have seen the AT&T/GNU C style is
    when I contributed to GNU projects.

    Now I see that GNU projects tend to follow AT&T styles often - the GNU Assembler by default uses AT&T syntax for i386/x86_64 architectures,
    makes sense now.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ar Rakin on Tue Feb 25 17:28:05 2025
    On 25/02/2025 16:34, Ar Rakin wrote:
    On 2/25/25 9:23 PM, David LaRue wrote:
    I used a style similar to this in school.  Before that I used much the
    same.
    As for existing code bases I prefer to keep their style and add comments
    accordingly.  That generally goes for any language.

    Agreed. For existing projects, the code style should be preserved.

    Yes - within reason. It is not good to be obsessive about coding style
    - even within existing projects with lots of contributors, there can
    sometimes be good reasons for wavering from a common style.

    And for your own code, don't be afraid to find a better way of writing
    your code. You don't have to be restricted to a C standard that was
    replaced a generation ago. You don't have to limit yourself to code
    that was designed to work well with computers, software and screens from
    four decades ago.

    If you feel that the GNU or Linux coding styles work well for the code
    you want to write, fair enough. But don't use them simply because GNU
    or Linux uses them - unless you are contributing to GNU or Linux projects.


    Popularity of a style shouldn't be a goal.  It should be consistantly
    readable and documented.  We must write for ourselves as well as our
    future
    self and others.

    This is true. I just wanted to know which style most people seem to prefer.


    There is no one style that has anything like a majority position,
    especially not when you consider all the possible variations. And even
    if there was, picking a style due to popularity is as sane as picking a religion based on popularity.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to David Brown on Tue Feb 25 22:52:52 2025
    On 2/25/25 10:28 PM, David Brown wrote:

    And for your own code, don't be afraid to find a better way of writing
    your code.  You don't have to be restricted to a C standard that was replaced a generation ago.  You don't have to limit yourself to code
    that was designed to work well with computers, software and screens from
    four decades ago.

    I agree! The C projects that I have built use latest C features. I
    usually always use the `-std=gnu17` or `-std=gnu23` compiler flag. (Yes,
    I do use the GNU C extensions often.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to John McCue on Wed Feb 26 00:39:19 2025
    On 2/26/25 12:36 AM, John McCue wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    GNU Style for me.

    <snip>

    3. Other Styles?

    BSD ? Not sure how different it is from Linux, but OpenBSD
    has a detail write up in manual style(9):

    https://man.openbsd.org/style

    FWIW, people really should learn to use indent(1), will help
    with many of these arguments :) For example:

    GNU Style for use with BSD indent(1), File .indent.pro, but
    BSD indent(1) may format it a bit different that GNU indent(1).
    -i2
    -bl
    -lp
    -nce

    GNU Style for use with GNU indent(1), File .indent.pro
    --gnu-style
    --dont-format-comments
    --no-space-after-function-call-names
    --dont-break-procedure-type
    --line-length78
    --case-indentation2

    Thank you.
    your welcome


    Interesting. The OpenBSD code style seems like a mixture of both the GNU
    and Linux styles. Good to know!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to John McCue on Tue Feb 25 18:51:51 2025
    On 2025-02-25, John McCue <jmccue@reddwf.jmcunx.com> wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    GNU Style for me.

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    Four space indentation, but braces half-indent by two spaces.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From John McCue@21:1/5 to Ar Rakin on Tue Feb 25 18:36:52 2025
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    GNU Style for me.

    <snip>

    3. Other Styles?

    BSD ? Not sure how different it is from Linux, but OpenBSD
    has a detail write up in manual style(9):

    https://man.openbsd.org/style

    FWIW, people really should learn to use indent(1), will help
    with many of these arguments :) For example:

    GNU Style for use with BSD indent(1), File .indent.pro, but
    BSD indent(1) may format it a bit different that GNU indent(1).
    -i2
    -bl
    -lp
    -nce

    GNU Style for use with GNU indent(1), File .indent.pro
    --gnu-style
    --dont-format-comments
    --no-space-after-function-call-names
    --dont-break-procedure-type
    --line-length78
    --case-indentation2

    Thank you.
    your welcome

    --
    csh(1) - "An elegant shell, for a more... civilized age."
    - Paraphrasing Star Wars

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Kaz Kylheku on Tue Feb 25 19:33:51 2025
    Kaz Kylheku <643-408-1753@kylheku.com> writes:
    On 2025-02-25, John McCue <jmccue@reddwf.jmcunx.com> wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    GNU Style for me.

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    Four space indentation, but braces half-indent by two spaces.

    Which is one of the goofier styles I've seen. Although I don't recall
    ever seeing it actually done that way, even in gnu code.

    Wastes a lot of vertical space with the opening brace on
    a separate line. Perhaps not as annoying with a 64 line
    window, but really sucks in a 24x80.

    I'll never adopt that style, nor attempt to match it. But then,
    I've don't recall ever seeing any software that used that style.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ar Rakin on Tue Feb 25 20:35:50 2025
    On 25/02/2025 17:52, Ar Rakin wrote:
    On 2/25/25 10:28 PM, David Brown wrote:

    And for your own code, don't be afraid to find a better way of writing
    your code.  You don't have to be restricted to a C standard that was
    replaced a generation ago.  You don't have to limit yourself to code
    that was designed to work well with computers, software and screens
    from four decades ago.

    I agree! The C projects that I have built use latest C features. I
    usually always use the `-std=gnu17` or `-std=gnu23` compiler flag. (Yes,
    I do use the GNU C extensions often.)

    In that case, use // comments instead of /* */ comments when it makes
    sense. Use line layout that makes sense and suits /your/ usage - don't
    use a layout for function definitions based on what some ancient editor
    liked unless you also like that ancient editor, or you like that layout.
    Pick a tab size that suits /your/ preferences for coding, using tab characters or spaces for whatever works best with /your/ choice of tools.

    It's fine to have different preferences - and some layouts are better
    than others for certain types of code, or when working with particular
    tools. The type of code you are working on can affect how well a
    particular style suits the code.

    So don't try to look for some kind of perfect "universal" style. All
    you can be sure of is that whatever style you use, the next person that
    looks at your code will think it's uglier or more error-prone than their preferred style. That applies even if the "next person" is yourself in
    a few years time.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Kaz Kylheku on Tue Feb 25 20:21:12 2025
    On 25/02/2025 18:51, Kaz Kylheku wrote:
    On 2025-02-25, John McCue <jmccue@reddwf.jmcunx.com> wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    GNU Style for me.

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }


    This puts me in mind of trying to find the meat in a thin soup!

    15 lines here, but in my personal syntax, it would be 8, and in Python
    style, it might be only 6.

    If I wrote it as C, I think it would be 10 lines (for example, it needs 'break').

    There are actually only two lines here that do anything.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Scott Lurndal on Tue Feb 25 20:40:14 2025
    On 2025-02-25, Scott Lurndal <scott@slp53.sl.home> wrote:
    Kaz Kylheku <643-408-1753@kylheku.com> writes:
    On 2025-02-25, John McCue <jmccue@reddwf.jmcunx.com> wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all >>>> about that question. Which one of the following do you prefer the most? >>>
    GNU Style for me.

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    Four space indentation, but braces half-indent by two spaces.

    Which is one of the goofier styles I've seen. Although I don't recall
    ever seeing it actually done that way, even in gnu code.

    GNU code in official GNU projects is full of it. I picked this
    file just now at random: hash.c in GNU Make:

    https://git.savannah.gnu.org/cgit/make.git/tree/src/hash.c

    Let's hit something else at random. How about GNU Emacs.
    Being a Lisp guy, eval.c catches my eye:

    https://git.savannah.gnu.org/cgit/emacs.git/tree/src/eval.c

    Goofy indents again.

    GNU Bash, sig.c:

    https://git.savannah.gnu.org/cgit/bash.git/tree/sig.c

    Oh, look!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Kaz Kylheku on Tue Feb 25 21:09:29 2025
    Kaz Kylheku <643-408-1753@kylheku.com> writes:
    On 2025-02-25, Scott Lurndal <scott@slp53.sl.home> wrote:
    Kaz Kylheku <643-408-1753@kylheku.com> writes:
    On 2025-02-25, John McCue <jmccue@reddwf.jmcunx.com> wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all >>>>> about that question. Which one of the following do you prefer the most? >>>>
    GNU Style for me.

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    Four space indentation, but braces half-indent by two spaces.

    Which is one of the goofier styles I've seen. Although I don't recall
    ever seeing it actually done that way, even in gnu code.

    GNU code in official GNU projects is full of it. I picked this
    file just now at random: hash.c in GNU Make:

    https://git.savannah.gnu.org/cgit/make.git/tree/src/hash.c

    Let's hit something else at random. How about GNU Emacs.
    Being a Lisp guy, eval.c catches my eye:

    https://git.savannah.gnu.org/cgit/emacs.git/tree/src/eval.c

    Goofy indents again.

    GNU Bash, sig.c:

    https://git.savannah.gnu.org/cgit/bash.git/tree/sig.c

    Oh, look!

    I've spent my time with gcc and binutils.


    gcc (4.8.3 was handy): Not even GNU style declaration...

    /* Caller does not hold allocation lock. */
    void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
    {
    register int i;
    GC_bool ignore_gcj_info;
    DCL_LOCK_STATE;

    GC_init(); /* In case it's not already done. */
    DISABLE_SIGNALS();
    LOCK();
    if (GC_gcj_malloc_initialized) {
    UNLOCK();
    ENABLE_SIGNALS();
    return;
    }
    GC_gcj_malloc_initialized = TRUE;
    ignore_gcj_info = (0 != GETENV("GC_IGNORE_GCJ_INFO"));
    # ifdef CONDPRINT
    if (GC_print_stats && ignore_gcj_info) {
    GC_printf0("Gcj-style type information is disabled!\n");
    }
    # endif
    GC_ASSERT(GC_mark_procs[mp_index] == (GC_mark_proc)0); /* unused */
    GC_mark_procs[mp_index] = (GC_mark_proc)mp;
    if (mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index");
    /* Set up object kind gcj-style indirect descriptor. */
    GC_gcjobjfreelist = (ptr_t *)GC_new_free_list_inner();
    if (ignore_gcj_info) {
    /* Use a simple length-based descriptor, thus forcing a fully */
    /* conservative scan. */
    GC_gcj_kind = GC_new_kind_inner((void **)GC_gcjobjfreelist,
    (0 | GC_DS_LENGTH),
    TRUE, TRUE);
    } else {
    GC_gcj_kind = GC_new_kind_inner(
    (void **)GC_gcjobjfreelist,
    (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS))
    | GC_DS_PER_OBJECT),
    FALSE, TRUE);
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Ar Rakin on Tue Feb 25 22:47:57 2025
    On 25.02.2025 16:15, Ar Rakin wrote:
    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style
    [...]

    2. Linux Style
    [...]

    3. Other Styles?
    [...]
    Please show an example!

    In professional contexts there's often coding guidelines that define
    the coding style standards & recommendations for companies or projects.

    I've got the impression that every individual has its own preference, generally. So N individuals => N+1 existing "preferred styles" :-)

    I suggest to inspect some publicly available coding standards to see
    the many possible custom definitions; that will give you an impression
    how many style variants you can expect.

    (Mine doesn't matter; but it's not identical to 1. or 2. above.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rosario19@21:1/5 to rakinar2@onesoftnet.eu.org on Tue Feb 25 22:46:50 2025
    On Tue, 25 Feb 2025 21:15:12 +0600, Ar Rakin
    <rakinar2@onesoftnet.eu.org> wrote:

    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk
    {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    static inline void *
    get_chunk_ptr (struct malloc_chunk *chunk)
    {
    return (void *) (chunk + 1);
    }

    void *
    malloc (size_t size)
    {
    struct malloc_chunk *chunk = mm_find_chunk (size, MM_CHUNK_FREE);

    if (chunk)
    return get_chunk_ptr (chunk);

    chunk = mm_alloc_chunk (size);

    if (!chunk)
    return NULL;

    return get_chunk_ptr (chunk);
    }

    ---------


    2. Linux Style

    ---------

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free; /* Whether this chunk is usable. */
    size_t size; /* The size of this chunk. */
    };

    static inline void *get_chunk_ptr(struct malloc_chunk *chunk)
    {
    return (void *) (chunk + 1);
    }

    void *malloc(size_t size)
    {
    struct malloc_chunk *chunk = mm_find_chunk(size, MM_CHUNK_FREE);

    if (chunk)
    return get_chunk_ptr(chunk);

    chunk = mm_alloc_chunk(size);

    if (!chunk)
    return NULL;

    return get_chunk_ptr(chunk);
    }

    ---------

    3. Other Styles?

    Please show an example!

    Thank you.

    above it seems the same stile

    #include <stddef.h>
    #include <stdbool.h>

    #include "malloc_internals.h"

    struct malloc_chunk {
    struct malloc_chunk *next; /* The next chunk. */
    struct malloc_chunk *prev; /* The previous chunk. */
    bool is_free;/*Whether this chunk is usable.*/
    size_t size; /* The size of this chunk. */
    };

    static inline void *get_chunk_ptr(struct malloc_chunk *chunk)
    {return (void *)(chunk+1);}

    void *malloc(size_t size)
    {struct malloc_chunk *chunk = mm_find_chunk(size, MM_CHUNK_FREE);

    if( chunk)return get_chunk_ptr(chunk);
    if(!(chunk = mm_alloc_chunk(size))) return NULL;
    return get_chunk_ptr(chunk);
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Scott Lurndal on Tue Feb 25 22:51:01 2025
    On 25.02.2025 17:17, Scott Lurndal wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    On 2/25/25 9:23 PM, David LaRue wrote:
    I used a style similar to this in school. Before that I used much the same.
    As for existing code bases I prefer to keep their style and add comments >>> accordingly. That generally goes for any language.

    Agreed. For existing projects, the code style should be preserved.

    Popularity of a style shouldn't be a goal. It should be consistantly
    readable and documented. We must write for ourselves as well as our future >>> self and others.

    This is true. I just wanted to know which style most people seem to prefer. >>
    Thanks for your response!

    I prefer the AT&T style (which you call GNU style, but which actually predates Stallman).

    The vi(1) editor has several commands that are designed to support
    the AT*T (or more properly, Bell Labs) style, such as the '[['
    and ']]' commands.

    For non-Vi/Vim users it may be useful to point out that there's so
    many navigation commands for all sorts of syntactical constructs,
    whether editing programming languages, prose text, or data, that
    you can choose your preferred way - and there are typically more
    ways than just one - to navigate to any entity.

    Starting a function definition with
    the function name in column 1 enables the use of the VI

    /^main

    command to easily move the cursor to the start of a named function.

    Yeah, I know that "advantage" from some projects; I never liked the
    function return type to be on a separate line, though. (And I never
    felt a need for that search in the first place. - Occasionally (but
    rarely) I worked with Vi-supported tags. Mileages vary, of course.)

    I'm fine with just searching the function name and typing 'n' or 'N'
    to reach other places. - With Vim, BTW, there's the nice command to
    "jump to definition" (with 'gD'); and this function is independent
    of whether the name is (without spaces) left aligned in column 1 or
    somewhere else. So I can just search '/' without '^' and optionally
    'gD' in case I've not landed in the definition already. That command
    also works with items other than function names, e.g. with variable
    definitions or function parameters that I also don't want to have
    separated from its type [just to serve the editor].
    (Disclaimer: I've used this feature only in C and C++ so I can't tell suitability for other common languages. But see the note above about
    the many powerful language-agnostic positioning options in Vi/Vim.)

    Generally I prefer to not have the editor impose the "rules" for
    source code formatting in any language. (Again, YMMV.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Tue Feb 25 22:59:11 2025
    On 25.02.2025 17:28, David Brown wrote:
    [...]

    Yes - within reason. It is not good to be obsessive about coding style
    - even within existing projects with lots of contributors, there can sometimes be good reasons for wavering from a common style.

    Good coding guidelines typically allow deviations, though some require
    explicit justification.

    Generally the project manager must weigh out the grade of admittance;
    being too sloppy will lead to a jungle of individual "good reasons"
    (that you don't want to foster).

    [...]
    [...]

    There is no one style that has anything like a majority position,
    especially not when you consider all the possible variations.

    Yep.

    And even
    if there was, picking a style due to popularity is as sane as picking a religion based on popularity.

    Most religious associations seem to have not been chosen by free will.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Tue Feb 25 23:02:43 2025
    On 25.02.2025 20:35, David Brown wrote:
    [...]
    Pick a tab size that suits /your/ preferences for coding, using tab characters or spaces for whatever works best with /your/ choice of tools.

    But only in your own projects. - Whenever you work in larger contexts
    this shouldn't - any typically doesn't - apply any more.

    Janis

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Scott Lurndal on Tue Feb 25 23:10:52 2025
    On 25.02.2025 20:33, Scott Lurndal wrote:
    Kaz Kylheku <643-408-1753@kylheku.com> writes:

    OP didn't properly characterize GNU style.

    GNU style is actually something like this:
    [...]
    Four space indentation, but braces half-indent by two spaces.

    Which is one of the goofier styles I've seen. Although I don't recall
    ever seeing it actually done that way, even in gnu code.

    Re "goofy style"; I've seen someone preferring

    while (q(a,b))
    {
    a=b;
    f(x);
    if (c>d)
    {
    g(y);
    }
    }

    To each his own.

    Janis

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Ar Rakin on Tue Feb 25 22:48:40 2025
    On Tue, 25 Feb 2025 21:15:12 +0600, Ar Rakin wrote:

    Which one of the following do you prefer the most?

    None of them:

    struct malloc_chunk /* header on each memory block */
    {
    struct malloc_chunk *next; /* doubly-linked list */
    struct malloc_chunk *prev;
    bool is_free;
    size_t size;
    } /*malloc_chunk*/;

    static inline void * get_chunk_ptr
    (
    struct malloc_chunk * chunk
    )
    /* returns pointer to the memory block excluding the header. */
    {
    return
    (void *)(chunk + 1);
    } /*get_chunk_ptr*/

    void * malloc
    (
    size_t size
    )
    /* allocates a memory block of the specified size,
    or NULL if none available. */
    {
    struct malloc_chunk * chunk = mm_find_chunk
    (
    /*size = */ size,
    /*type =*/ MM_CHUNK_FREE
    );
    if (chunk == NULL)
    {
    chunk = mm_alloc_chunk(size);
    } /*if*/
    return
    chunk != NULL ?
    get_chunk_ptr(chunk)
    :
    NULL;
    } /*malloc*/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Janis Papanagnou on Wed Feb 26 09:41:48 2025
    On 25/02/2025 23:02, Janis Papanagnou wrote:
    On 25.02.2025 20:35, David Brown wrote:
    [...]
    Pick a tab size that suits /your/ preferences for coding, using tab
    characters or spaces for whatever works best with /your/ choice of tools.

    But only in your own projects. - Whenever you work in larger contexts
    this shouldn't - any typically doesn't - apply any more.


    Sure. But that has been covered already - for existing projects, it is
    usually best to stick to a consistent existing style. The same applies
    for code that is part of a project group, or written in a company with a standard style, or if there is something else requiring a specific style
    for the code (such as MISRA).

    Even then, however, I would suggest challenging the status quo. That
    does not mean overriding the existing style choices, but it /does/ mean questioning them. Just because a project, company, or group has always
    used a particular style, does not mean there are good reasons for the
    choices - or that the original reasons are still relevant. Of course
    changing the style of existing code, or code added to an existing
    project, requires a lot stronger motivation than "I think it looks
    nicer" reasoning which is fine for picking your own style for your own code.

    Style choices - like pretty much anything else in software development -
    should not be set in stone. Equally, it should not be changed lightly.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to David Brown on Thu Feb 27 22:04:09 2025
    David Brown <david.brown@hesbynett.no> writes:

    On 26/02/2025 15:39, Bradley K. Sherman wrote:
    Just do your best to keep it neat and under 80 columns.


    Neat, yes. 80 columns, no - unless you are living in the previous century.

    Lines that are too long are hard to read, but the idea that 80 columns
    is a good number or should be a hard limit is /long/ outdated. About
    100 - 120 columns is a better fit for a lot of code, letting you use
    sensible identifiers without excessively splitting logical lines into multiple physical lines.

    Agreed. Unfortunately, most GNU projects still require you to not exceed
    80 columns per line, in the code. It is a bit too hard limit.

    --
    Ar Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to Lawrence D'Oliveiro on Thu Feb 27 22:11:54 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Wed, 26 Feb 2025 13:39:12 +0100, Janis Papanagnou wrote:

    There's reasons why folks stay with ("ancient") Emacs and Vi/Vim!

    Emacs I can understand, vi/vim I can’t.

    Richard Stallman, the Saint of the Church of Emacs, once said,
    "Vi-vi-vi is definitely the editor of the beast."

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ar Rakin on Thu Feb 27 17:23:41 2025
    On 27/02/2025 14:05, Ar Rakin wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Wed, 26 Feb 2025 13:31:51 -0800, Keith Thompson wrote:

    One interesting feature of Perl is that the braces are required.

    And yet it doesn’t have C-style macros, which to me are the most obvious >> way one can get into trouble by omitting needed braces.

    What do you mean? Sorry I'm stupid sometimes.

    He is thinking of situations like this (ignore the stupidity of the
    example) :

    #define message(x) printf("Message: "); printf(x); printf("\n")

    void foo(int y) {
    message("Starting foo... ");
    if (y < 0)
    message("Y is negative");
    message("Done foo.")
    }

    Reading "foo", you'd think that it would print "Message: Y is
    negative\n" if y is negative. But in fact only the first statement in
    the macro is covered by the conditional, and "Y is negative\n" will
    always be printed. You can easily imagine how things could get a whole
    lot worse from such mixups.

    There are many ways to avoid this, including putting a "do { ... } while
    (0)" wrapper around the statements in the macro, using an inline
    function instead of a macro, writing macro names in all-caps as a
    warning (I strongly dislike that convention), and always using braces
    with conditionals even if they appear to cover just one statement.

    I am not sure if there is a basis for judging the "most obvious" problem
    that can occur from omitting braces in conditionals, but this is
    certainly a strong contender for the title.

    Another case that occurs is confusion about matching up else's with if's
    in nested conditionals without braces.




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Richard Heathfield on Thu Feb 27 17:26:29 2025
    On 27/02/2025 15:13, Richard Heathfield wrote:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal doesn't happen until Translation Phase3. If a compiler /didn't/ splice those
    lines, /that/ would be a bug.


    The bug, of course, is using Windows and Windows-style paths :-)

    (Nice to have you back, Richard.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ar Rakin on Thu Feb 27 17:33:54 2025
    On 27/02/2025 16:13, Ar Rakin wrote:
    On 2/27/25 8:16 PM, Scott Lurndal wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No, it is standard C line continuation behavior remaining from
    the days of punched cards.  More useful for strings
    and invented prior to the invention of unterminated comments (//).


    Understood.

    Even though I have been writing C code for around four years now, I
    still learn new things about this *simple* language every day.


    Like most quirks, as found in every language, you have to be very
    unlucky to be hit by it, and extraordinarily unlucky to do so without it
    being immediately obvious when you compile your code or at least when
    you try to run it. And it's peanuts to avoid triggering it once you
    know about it - but most people can spend their entire careers as C
    programmers without ever coming across it.

    These things can be inconvenient for people making C tools (compilers,
    syntax highlighters, etc.), but are rarely a problem for C programmers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to David Brown on Thu Feb 27 23:17:14 2025
    On 2/27/25 10:23 PM, David Brown wrote:
    On 27/02/2025 14:05, Ar Rakin wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Wed, 26 Feb 2025 13:31:51 -0800, Keith Thompson wrote:

    One interesting feature of Perl is that the braces are required.

    And yet it doesn’t have C-style macros, which to me are the most obvious >>> way one can get into trouble by omitting needed braces.

    What do you mean? Sorry I'm stupid sometimes.

    He is thinking of situations like this (ignore the stupidity of the
    example) :

    #define message(x) printf("Message: "); printf(x); printf("\n")

    void foo(int y) {
        message("Starting foo... ");
        if (y < 0)
            message("Y is negative");
        message("Done foo.")
    }

    Reading "foo", you'd think that it would print "Message: Y is
    negative\n" if y is negative.  But in fact only the first statement in
    the macro is covered by the conditional, and "Y is negative\n" will
    always be printed.  You can easily imagine how things could get a whole
    lot worse from such mixups.

    There are many ways to avoid this, including putting a "do { ... } while
    (0)" wrapper around the statements in the macro, using an inline
    function instead of a macro, writing macro names in all-caps as a
    warning (I strongly dislike that convention), and always using braces
    with conditionals even if they appear to cover just one statement.

    I am not sure if there is a basis for judging the "most obvious" problem
    that can occur from omitting braces in conditionals, but this is
    certainly a strong contender for the title.

    Another case that occurs is confusion about matching up else's with if's
    in nested conditionals without braces.




    Ah, I see. Thanks for explaining.

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to David Brown on Thu Feb 27 17:27:17 2025
    On 27/02/2025 16:33, David Brown wrote:
    On 27/02/2025 16:13, Ar Rakin wrote:
    On 2/27/25 8:16 PM, Scott Lurndal wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No, it is standard C line continuation behavior remaining from
    the days of punched cards.  More useful for strings
    and invented prior to the invention of unterminated comments (//).


    Understood.

    Even though I have been writing C code for around four years now, I
    still learn new things about this *simple* language every day.


    Like most quirks, as found in every language, you have to be very
    unlucky to be hit by it, and extraordinarily unlucky to do so without it being immediately obvious when you compile your code or at least when
    you try to run it.  And it's peanuts to avoid triggering it once you
    know about it - but most people can spend their entire careers as C programmers without ever coming across it.

    These things can be inconvenient for people making C tools (compilers,
    syntax highlighters, etc.), but are rarely a problem for C programmers.


    Problems involving \ and // commonly come up with multi-line macros.
    Suppose your macro looks like this:

    #define M \
    a=0;\
    b=0;\
    c=0;

    By itself it'll work; M expands to 'a=0;b=0;c=0;'. But then you want to
    comment each line. Both of these methods have problems:

    #define M \
    a=0;\ // one
    b=0;\ // two
    c=0; // three

    #define M \
    a=0; // one\
    b=0; // two\
    c=0; // three

    In the first, the \ no longer acts as line continuation (just the
    following space will be troublesome); the last two lines are outside the definition, and the part that is expanded has a stray \.

    In the second, the lines are joined, but the b=0/c=0 lines become part
    of the first comment.

    The only method that works is to use /*...*/ comments, and have the \
    right at the end.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ar Rakin on Thu Feb 27 21:10:34 2025
    On 27/02/2025 17:04, Ar Rakin wrote:
    David Brown <david.brown@hesbynett.no> writes:

    On 26/02/2025 15:39, Bradley K. Sherman wrote:
    Just do your best to keep it neat and under 80 columns.


    Neat, yes. 80 columns, no - unless you are living in the previous century. >>
    Lines that are too long are hard to read, but the idea that 80 columns
    is a good number or should be a hard limit is /long/ outdated. About
    100 - 120 columns is a better fit for a lot of code, letting you use
    sensible identifiers without excessively splitting logical lines into
    multiple physical lines.

    Agreed. Unfortunately, most GNU projects still require you to not exceed
    80 columns per line, in the code. It is a bit too hard limit.


    Then you are back to following the style rules of an existing project,
    because consistency is often helpful - even if those rules were made
    many decades ago and are really ugly (in my highly subjective opinion).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to bart on Thu Feb 27 21:14:43 2025
    On 27/02/2025 18:27, bart wrote:
    On 27/02/2025 16:33, David Brown wrote:
    On 27/02/2025 16:13, Ar Rakin wrote:
    On 2/27/25 8:16 PM, Scott Lurndal wrote:
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example: >>>>>>
        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No, it is standard C line continuation behavior remaining from
    the days of punched cards.  More useful for strings
    and invented prior to the invention of unterminated comments (//).


    Understood.

    Even though I have been writing C code for around four years now, I
    still learn new things about this *simple* language every day.


    Like most quirks, as found in every language, you have to be very
    unlucky to be hit by it, and extraordinarily unlucky to do so without
    it being immediately obvious when you compile your code or at least
    when you try to run it.  And it's peanuts to avoid triggering it once
    you know about it - but most people can spend their entire careers as
    C programmers without ever coming across it.

    These things can be inconvenient for people making C tools (compilers,
    syntax highlighters, etc.), but are rarely a problem for C programmers.


    Problems involving \ and // commonly come up with multi-line macros.

    I think it is fair and useful to point this out as a potential problem
    or complication - I don't think it is equally fair to characterise it as "common".

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Thu Feb 27 23:24:45 2025
    On Thu, 27 Feb 2025 17:27:17 +0000, bart wrote:

    Problems involving \ and // commonly come up with multi-line macros.

    C macros are yet another example of the wrong way to do macros.

    The only right way to do macros is at the AST level.

    Think how many problems would be solved if you could do gensym in a C
    macro.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to David Brown on Fri Feb 28 00:29:29 2025
    On 27/02/2025 15:47, David Brown wrote:

    Newspaper columns are often much shorter - 30 to 40 characters.  So why
    is that?

    Because newspapers are basically in portrait format, so long thin
    columns fit well.

    Computer terminals, back in the day, were basically square, so 80
    columns was often a hard limit.

    Now you have larger landscape screens, with windows that can be
    stretched as wide as you like.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From candycanearter07@21:1/5 to David Brown on Fri Feb 28 02:40:02 2025
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT):
    On 27/02/2025 15:13, Richard Heathfield wrote:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal doesn't
    happen until Translation Phase3. If a compiler /didn't/ splice those
    lines, /that/ would be a bug.


    The bug, of course, is using Windows and Windows-style paths :-)

    (Nice to have you back, Richard.)


    What's worse, its a WONTFIX!
    --
    user <candycane> is generated from /dev/urandom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to candycanearter07@candycanearter07.n on Fri Feb 28 04:29:19 2025
    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT):
    lines, /that/ would be a bug.

    The bug, of course, is using Windows and Windows-style paths :-)

    What's worse, its a WONTFIX!

    Not sure what you're talking about. All Microsoft operating systems
    going back to MS-DOS have accepted the forward slash as an alternative
    path separator. C:/Windows/System32 is a legitimate Windows-style path.
    Some incorrectly-written user space programs might not like it.


    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Janis Papanagnou on Fri Feb 28 08:55:13 2025
    On 28/02/2025 07:50, Janis Papanagnou wrote:
    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:
    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I
    frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    What would be your typical indent distribution in your "C" source code?

    I looked at around 100 KLOC and was surprised to find that my
    modal indent count was 3, which is lower than I expected. On the
    other hand, I maxed out at 24.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Fri Feb 28 08:50:51 2025
    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:
    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or
    develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of
    indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    What would be your typical indent distribution in your "C" source code?

    (I wouldn't expect something completely different, but I also wouldn't
    care if there would be.)[*]

    Janis

    PS: Note that your frequent indents of level 6 would in my setting with
    a TAB of four mean 24 colums and would leave (for an 80 column window)
    still 56 columns for "C" statements (in case you don't want to pass the
    limit).

    PPS: In the mentioned toy project I have 849 lines that stay within 80
    columns and 38 lines that exceed that limit; the histogram distribution

    N line length range
    172 1-10
    128 11-20
    106 21-30
    90 31-40
    68 41-50
    51 51-60
    100 61-70
    134 71-80
    28 81-90
    8 91-100
    2 101-110

    where the upper range is in more detail sparsely defined by

    amount line length
    ...
    1 91
    3 92
    1 93
    1 94
    1 95
    1 100
    1 101
    1 107

    where the longer lines are not complex code but stem from lines with
    (long) strings in fprintf() information. Lines with non-printf/string
    code are generally of length <90, or even <85 (the one long getopt()
    line also has a long string literal, as I got aware).

    [*] BTW; my hypothesis is that the actual line length distribution is
    depending on the used window sizes. I had observed that folks who use
    wide editor windows (or IDEs with wide windows) create wider source
    code. I usually use 80 columns editing windows and thus naturally get
    an indication when to wrap lines (without actively thinking about it).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Fri Feb 28 10:00:42 2025
    On 27.02.2025 16:47, David Brown wrote:
    On 27/02/2025 06:57, Janis Papanagnou wrote:
    On 26.02.2025 20:56, David Brown wrote:
    On 26/02/2025 18:13, Janis Papanagnou wrote:
    On 26.02.2025 17:32, David Brown wrote:
    On 26/02/2025 15:39, Bradley K. Sherman wrote:
    Just do your best to keep it neat and under 80 columns.

    [...]

    Since decades now there are no such hard limits, so why do you make
    up such a statement.

    That's exactly the point - there /are/ no real hard limits, and have not
    been any since we moved on from pure text-mode terminals. Some
    situations have short line limits (such as for a slideshow in a presentation), most situations for normal coding can be as wide as the developer finds convenient.

    With presentations I've noticed another extremely strange (human)
    behavior. Lastly I worked in a context where they used PPT as medium
    for all sorts of text communication; evaluations, documentation, etc.
    Because of the auto-adjustment of font-sizes depending on the amount
    of text they stuffed many PPT slides full of information so that the
    resulting text became something like a 6pt text with extremely long
    lines. - I've in a recent posting mentioned that my hypothesis is
    that the available/used medium influences what you get as outcome,
    and some consider less whether it's readable in the first place.


    So why do some people think that 80 columns should be a hard limit to
    their line length? They do not, for the most part, think 80 characters
    is ideal for readability, or for display, or for printing, or for
    writing code, or for reviewing it, or for any other use. For the most
    part, they don't think at all. They simply regurgitate 80 columns
    because IBM picked 80 columns as the width of punched cards in 1928. If
    IBM had picked 72 columns or 96 columns, Bradley would have written
    "Just do your best to keep it neat and under 72 columns" or "Just do
    your best to keep it neat and under 96 columns".

    That is IMO not accurately describing it (given that some columns on
    the punch cards in languages of these days had a special meaning and
    were not available for program text). But I had already commented on
    the historic evolution before and also said that some _sensible_ size
    (as opposed to an arbitrary size) had been chosen. (I won't reiterate
    that here.)

    [...]

    In newspapers you can find articles that can span even a whole page.
    It's nonetheless organized in small columns.

    Of course different newspapers do things differently.

    Most (all?) newspapers (at least hereabouts) do things quite similarly.


    And maybe there are other reasons for having columns that are often far
    too narrow for legibility, sometimes leading to horrible inconsistent spacing, really messy hyphenation, and the like.

    I agree that too narrow columns are as well a problem.


    Columns are clearly required for newspapers - the pages are (usually)
    far too wide to be comfortable to read without splitting up into
    columns. The question is what width they should be.

    Generally, around 60 - 70 characters is common for quick, easy reading,
    such as most books. Technical documents can have a good deal more - a
    quick check suggests that the C standards have around 90 characters per
    line, while the C++ standards (with a smaller typeface) have about 105.
    A technical white paper that I happen to have open at the moment has 120 character lines.

    Newspaper columns are often much shorter - 30 to 40 characters. So why
    is that?

    The prime purpose of a newspaper is, obviously, to make money. The more
    you put in the same area, the better. Having regular column sizes
    reduces costs (especially before computer-based layout and printing). It makes it easier to sell advertising space.

    I take this as your opinion (or hypothesis).


    Modern newspapers can be more flexible in their layouts, but keeping a familiar look is important. Legibility of individual columns of text is
    much less important - after all, most readers scan headlines and only
    read a small proportion of the column text.

    I cannot speak for "most readers", so I don't want to comment on that
    part of your statement.

    WRT [online-] layout of "modern newspapers" I observe various things
    (in my domain); one is that lines of 60-70 columns are quite typical
    now. Another observation is that some media don't care any more about legibility of (longer) texts by using or switching to sans-serif fonts.


    These numbers appear strange to me. - A quick look into a couple of
    different editions show more like 45-90 characters, with typical
    values around 55-70 (including spaces counted as characters), i.e.
    not in the extreme ranges. For these numbers I've inspected random
    books written in different layouts, in three different languages,
    and of different types. - I would be very astonished if that would
    be fundamentally different in your language domain, but YMMV.


    What did you actually look at? Novels? Textbooks? Documents written
    for A4 page sizes? Newspapers? Old legal documents?

    As I wrote; all sorts of texts. Novels (in various editing forms, and
    written in DE, EN, and GR), technical books (EN and DE), old (historic)
    books and new editions, and so on. - All books more or less conform to
    the established values.

    (Yes, there are of course variances, but all in the discussed ranges.)


    So I have to conclude that printed typical text would fit regularly
    and easily in an 80 column mono-spaced medium.


    Your conclusion would be wrong, unless you are limiting it to specific
    areas. (The word "typical" is very vague.)

    Yes, the word is vague; but using any absolute term would be wrong and
    only provoke that one interested in arguing would pick up a "counter
    example". - It's the _typical_ "state of the art" that matters! (YMMV.)


    It's not about "small screens"; it's about readability as being a
    function of the used line-length. But readability, while probably
    a most important factor, is not the only aspect...


    I agree that readability is key here. But remember that readability of
    code is not the same thing as readability of prose.

    Sure. (Please note my respective statements in some of my other posts concerning that.)

    Doing too much in
    one line of code makes it hard to understand - regardless of how many characters it actually uses.

    I think we should abandon speaking about it in terms of characters.

    (I think we agreed that readability is the key, not a hard or soft
    column limit; typically used number of columns are nonetheless based
    on cultural - you may say also technical; still based on cultural -
    sensible heuristics. But habits seem to run out of control "lately".)

    Taking something that is logically one
    operation or expression and artificially splitting it into two (or more) lines to suit an arbitrary line length limit also makes the code hard to understand. [...]

    This may be the case or not. - That's the whole point; to organize the
    code to become clear. - A split may make it even better readable. (But
    a _misplaced_ split may make it worse.)

    Is that split in your opinion reducing readability...?

    if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
    &mutation_rates.base,
    &mutation_rates.genesis,
    &mutation_rates.aging,
    &mutation_rates.death
    ) != 4)

    or would you prefer it for (better?) readability to be in one line?


    Myself I usually operate on a minimum of two physical screens, and
    (with my font setting) each one capable of displaying two 80-column
    windows side by side.

    That seems small to me.

    Do you mean my screen or my default window size setting?

    I cannot help; I'm used to the two 24" screens that I have, and my age
    and health does not allow to regularly use font's below 10pt (or so).

    I have no problem with two approximately
    120-column windows side-by-side in my IDE,

    This actually explains your preferences; elsethread I wrote about my observations of people using larger defaults for window sizes, and
    specifically that I've observed IDE users to work with larger default
    window sizes also regularly don't mind writing code with (even much)
    longer lines.

    along with all the additional
    junk - file lists, code outlines, line numbers, scroll bars, etc.
    Sometimes I will have three files side-by-side, with a bit less space
    for the junk, depending on what I am doing. (I usually have other stuff
    like command windows, serial terminals, webpages, documents, etc., on
    the other screens.)

    [...]

    Sure. I do the same, for the same reasons. But I don't restrict myself
    to so short line lengths. (Of course most of the lines in my code are shorter than 80 characters.)

    I've earlier this morning posted some statistical data in this thread.

    (Given what you write here my guess is that our habits actually don't
    differ too much. And I think also our reasoning is not too different
    in principle, if I've read your post correctly. - Our differences are
    probably only in our observation, experiences, opinions, hypotheses,
    concerning the historic or cultural background.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Kaz Kylheku on Fri Feb 28 10:21:39 2025
    On 28/02/2025 05:29, Kaz Kylheku wrote:
    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT): >>>> lines, /that/ would be a bug.

    The bug, of course, is using Windows and Windows-style paths :-)

    What's worse, its a WONTFIX!

    Not sure what you're talking about. All Microsoft operating systems
    going back to MS-DOS have accepted the forward slash as an alternative
    path separator. C:/Windows/System32 is a legitimate Windows-style path.

    Yes, you can often use forward slashes for directory separations in
    Windows - but you can't do so everywhere. There's no doubt that forward slashes are the standard in the Windows world.

    Some incorrectly-written user space programs might not like it.


    Indeed - and that can be a pain.

    However, you can certainly use forward slashes in things like #include directives when using gcc on Windows, or in makefiles - and that covers
    a lot of my needs for path names!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Fri Feb 28 10:21:39 2025
    On 28.02.2025 09:55, Richard Heathfield wrote:
    On 28/02/2025 07:50, Janis Papanagnou wrote:
    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:
    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I
    frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or
    develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of
    indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    What would be your typical indent distribution in your "C" source code?

    I looked at around 100 KLOC and was surprised to find that my modal
    indent count was 3, which is lower than I expected.

    Intuitively I've also expected (slightly) higher values. (But
    obviously my code structuring wasn't as bad as I thought. :-)

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Fri Feb 28 10:22:11 2025
    On 27/02/2025 22:24, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

    fopen(file,"rb"); // open file in \windows\system32\
    fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.
    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal
    doesn't happen until Translation Phase3. If a compiler /didn't/ splice
    those lines, /that/ would be a bug.

    <OT>Long time no see. Welcome back!</OT>


    As long as it's not "Long time no C" :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Ar Rakin on Fri Feb 28 10:32:26 2025
    On 27.02.2025 14:02, Ar Rakin wrote:
    [...]

    Well, in the GNU style, function definitions are still different than
    other styles which I like:

    int
    main(int argc, char **argv)
    {
    printf ("Hello world\n");
    return 0;
    }

    Plus, you can also see how there is a *space* before the open
    parenthesis of function call expressions.

    A space in a function call, but no space in the main() definition?

    (In Awk, BTW, because of its primitive syntax, you may not place
    spaces in user-defined function calls, but may use spacing in the
    function definition. - But in "C" you may do as you prefer.)

    Many people argue that this is not a good idea, but I like it.

    Just avoid these "many people"! :-)

    But was there any _convincing_ argument to not do that?

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Janis Papanagnou on Fri Feb 28 10:19:49 2025
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as
    interesting as we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    <sigh>

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to David Brown on Fri Feb 28 10:24:19 2025
    On 28/02/2025 09:22, David Brown wrote:
    On 27/02/2025 22:24, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for
    example:

         fopen(file,"rb");   // open file in \windows\system32\
         fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.
    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal
    doesn't happen until Translation Phase3. If a compiler
    /didn't/ splice
    those lines, /that/ would be a bug.

    <OT>Long time no see.  Welcome back!</OT>


    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's proper
    C, of course, not this newfangled gibberish).

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Richard Heathfield on Fri Feb 28 13:03:45 2025
    On 28/02/2025 11:24, Richard Heathfield wrote:
    On 28/02/2025 09:22, David Brown wrote:
    On 27/02/2025 22:24, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example: >>>>>>
         fopen(file,"rb");   // open file in \windows\system32\
         fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.
    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal
    doesn't happen until Translation Phase3. If a compiler /didn't/ splice >>>> those lines, /that/ would be a bug.

    <OT>Long time no see.  Welcome back!</OT>


    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with \LaTeX, although when I do cut code it is in C (and that's proper C, of course,
    not this newfangled gibberish).


    LaTeX is great when it's all going well, but sometimes macros can get
    pretty hairy - I've written more than my share of unreadable macro code.
    There's also the risk that you spend so much time examining the
    microtyping and ligature generation at 1600% zoom on the pdf reader,
    that you don't have time to write the documents!

    Still, LaTeX (or LuaLaTeX, as I use these days) is better than anything
    else I know of.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Janis Papanagnou on Fri Feb 28 12:54:30 2025
    On 28/02/2025 10:00, Janis Papanagnou wrote:
    On 27.02.2025 16:47, David Brown wrote:
    On 27/02/2025 06:57, Janis Papanagnou wrote:
    On 26.02.2025 20:56, David Brown wrote:
    On 26/02/2025 18:13, Janis Papanagnou wrote:

    (I'm snipping part of this - I don't think it is really going anywhere,
    and certainly not anywhere topical for the group!)

    Doing too much in
    one line of code makes it hard to understand - regardless of how many
    characters it actually uses.

    I think we should abandon speaking about it in terms of characters.


    Agreed.

    (I think we agreed that readability is the key, not a hard or soft
    column limit; typically used number of columns are nonetheless based
    on cultural - you may say also technical; still based on cultural -
    sensible heuristics. But habits seem to run out of control "lately".)


    Yes.

    Taking something that is logically one
    operation or expression and artificially splitting it into two (or more)
    lines to suit an arbitrary line length limit also makes the code hard to
    understand. [...]

    This may be the case or not. - That's the whole point; to organize the
    code to become clear. - A split may make it even better readable. (But
    a _misplaced_ split may make it worse.)

    Sure. It is the "artificial" splitting merely to fit some line length
    rule that is the problem, not splitting in itself.


    Is that split in your opinion reducing readability...?

    if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
    &mutation_rates.base,
    &mutation_rates.genesis,
    &mutation_rates.aging,
    &mutation_rates.death
    ) != 4)

    or would you prefer it for (better?) readability to be in one line?


    Splitting is fine here - it is natural and fits the flow of the code.

    I might prefer to write it as :

    const int matches = sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
    &mutation_rates.base,
    &mutation_rates.genesis,
    &mutation_rates.aging,
    &mutation_rates.death
    );

    if (matches != 4) {

    since the "!= 4" bit looks a bit lonely and out of place in your code.
    But that is perhaps just splitting hairs :-)




    Myself I usually operate on a minimum of two physical screens, and
    (with my font setting) each one capable of displaying two 80-column
    windows side by side.

    That seems small to me.

    Do you mean my screen or my default window size setting?

    I cannot help; I'm used to the two 24" screens that I have, and my age
    and health does not allow to regularly use font's below 10pt (or so).


    I also have two 24" screens (on this computer), and my eyes are also not
    as good as they used to be. (In my youth, I used to write my notes on
    2mm graph paper - normal lined paper seemed a waste of space to me.)

    I have no problem with two approximately
    120-column windows side-by-side in my IDE,

    This actually explains your preferences; elsethread I wrote about my observations of people using larger defaults for window sizes, and specifically that I've observed IDE users to work with larger default
    window sizes also regularly don't mind writing code with (even much)
    longer lines.

    I don't go overboard on line length, but I do like to have more room
    than 80 characters, and I don't like hard limits. One factor in this is
    that a fair bit of my development is in C++ (on small embedded systems),
    and namespaces and classes mean that the average full identifier length
    is a fair amount longer than in C - thus it is natural for lines to be
    longer.

    I use IDE's often, but I also use lighter editors and occasionally
    command-line editors as well. It depends on the kind of project I am
    working on, and what I am doing with it - IDE's are heavier, but good if there's a lot of cross-file navigation and integration with a debugger
    and other tools. Other editors can often be more efficient for smaller
    tasks or non-coding work.


    (Given what you write here my guess is that our habits actually don't
    differ too much. And I think also our reasoning is not too different
    in principle, if I've read your post correctly. - Our differences are probably only in our observation, experiences, opinions, hypotheses, concerning the historic or cultural background.)


    That sounds about right. And I've no problem at all with those kinds of differences - my only problem is with people (not you) who think there
    are "magic" numbers and fixed rules that should always apply.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Richard Heathfield on Fri Feb 28 14:19:47 2025
    On Fri, 28 Feb 2025 10:24:19 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 28/02/2025 09:22, David Brown wrote:

    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's proper
    C, of course, not this newfangled gibberish).


    one man's newfangled gibberish is another man's proper C

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to David Brown on Fri Feb 28 12:21:01 2025
    On 28/02/2025 11:54, David Brown wrote:
    On 28/02/2025 10:00, Janis Papanagnou wrote:
    On 27.02.2025 16:47, David Brown wrote:
    On 27/02/2025 06:57, Janis Papanagnou wrote:
    On 26.02.2025 20:56, David Brown wrote:
    On 26/02/2025 18:13, Janis Papanagnou wrote:

    (I'm snipping part of this - I don't think it is really going anywhere,
    and certainly not anywhere topical for the group!)

    Doing too much in
    one line of code makes it hard to understand - regardless of how many
    characters it actually uses.

    I think we should abandon speaking about it in terms of characters.


    Agreed.

    (I think we agreed that readability is the key, not a hard or soft
    column limit; typically used number of columns are nonetheless based
    on cultural - you may say also technical; still based on cultural -
    sensible heuristics. But habits seem to run out of control "lately".)


    Yes.

    Taking something that is logically one
    operation or expression and artificially splitting it into two (or more) >>> lines to suit an arbitrary line length limit also makes the code hard to >>> understand. [...]

    This may be the case or not. - That's the whole point; to organize the
    code to become clear. - A split may make it even better readable. (But
    a _misplaced_ split may make it worse.)

    Sure.  It is the "artificial" splitting merely to fit some line length
    rule that is the problem, not splitting in itself.


    Is that split in your opinion reducing readability...?

             if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
                         &mutation_rates.base,
                         &mutation_rates.genesis,
                         &mutation_rates.aging,
                         &mutation_rates.death
                        ) != 4)

    or would you prefer it for (better?) readability to be in one line?


    Splitting is fine here - it is natural and fits the flow of the code.

    I might prefer to write it as :

        const int matches = sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
                &mutation_rates.base,
                &mutation_rates.genesis,
                &mutation_rates.aging,
                &mutation_rates.death
            );

        if (matches != 4) {

    since the "!= 4" bit looks a bit lonely and out of place in your code.
    But that is perhaps just splitting hairs :-)




    Myself I usually operate on a minimum of two physical screens, and
    (with my font setting) each one capable of displaying two 80-column
    windows side by side.

    That seems small to me.

    Do you mean my screen or my default window size setting?

    I cannot help; I'm used to the two 24" screens that I have, and my age
    and health does not allow to regularly use font's below 10pt (or so).


    I also have two 24" screens (on this computer), and my eyes are also not
    as good as they used to be.  (In my youth, I used to write my notes on
    2mm graph paper - normal lined paper seemed a waste of space to me.)

    I have no problem with two approximately
    120-column windows side-by-side in my IDE,

    This actually explains your preferences; elsethread I wrote about my
    observations of people using larger defaults for window sizes, and
    specifically that I've observed IDE users to work with larger default
    window sizes also regularly don't mind writing code with (even much)
    longer lines.

    I don't go overboard on line length, but I do like to have more room
    than 80 characters, and I don't like hard limits.  One factor in this is that a fair bit of my development is in C++ (on small embedded systems),
    and namespaces and classes mean that the average full identifier length
    is a fair amount longer than in C - thus it is natural for lines to be longer.

    Have your mental margin-bell ding at around 75 characters, and aim to
    thow a new line as soon a you can?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Richard Harnden on Fri Feb 28 14:44:42 2025
    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:

    On 27/02/2025 15:47, David Brown wrote:

    Newspaper columns are often much shorter - 30 to 40 characters. So
    why is that?

    Because newspapers are basically in portrait format, so long thin
    columns fit well.

    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    so 80
    columns was often a hard limit.

    Now you have larger landscape screens, with windows that can be
    stretched as wide as you like.


    For many years I use 1200x1920 (yes, portait) as my main monitor at
    work.
    Turning Full HD 90 degrees does not work as well - 1080 is too narrow.
    In this case 11% difference matters.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to Janis Papanagnou on Fri Feb 28 18:54:41 2025
    On 2/28/25 3:32 PM, Janis Papanagnou wrote:
    On 27.02.2025 14:02, Ar Rakin wrote:
    [...]

    Well, in the GNU style, function definitions are still different than
    other styles which I like:

    int
    main(int argc, char **argv)
    {
    printf ("Hello world\n");
    return 0;
    }

    Plus, you can also see how there is a *space* before the open
    parenthesis of function call expressions.

    A space in a function call, but no space in the main() definition?

    (In Awk, BTW, because of its primitive syntax, you may not place
    spaces in user-defined function calls, but may use spacing in the
    function definition. - But in "C" you may do as you prefer.)


    Apologies, I forgot to put a space after `main'.

    Many people argue that this is not a good idea, but I like it.

    Just avoid these "many people"! :-)


    Good point.

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to All on Fri Feb 28 18:59:34 2025
    On 2/28/25 8:40 AM, candycanearter07 wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT):
    On 27/02/2025 15:13, Richard Heathfield wrote:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for example:

        fopen(file,"rb");   // open file in \windows\system32\
        fread(...);

    Here, the // line continues onto the next, so that the fread is
    commented out. But they are fewer.

    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment removal doesn't >>> happen until Translation Phase3. If a compiler /didn't/ splice those
    lines, /that/ would be a bug.


    The bug, of course, is using Windows and Windows-style paths :-)

    (Nice to have you back, Richard.)


    What's worse, its a WONTFIX!

    Or maybe, "It's not a bug, it's a feature" :-)

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Kaz Kylheku on Fri Feb 28 15:30:07 2025
    On Fri, 28 Feb 2025 04:29:19 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:

    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday
    (GMT):
    lines, /that/ would be a bug.

    The bug, of course, is using Windows and Windows-style paths :-)

    What's worse, its a WONTFIX!

    Not sure what you're talking about. All Microsoft operating systems
    going back to MS-DOS have accepted the forward slash as an alternative
    path separator. C:/Windows/System32 is a legitimate Windows-style
    path. Some incorrectly-written user space programs might not like it.



    One of user spaces programs that does not like it is ubiquitous cmd.exe. cmd.exe accepts forward slashes in cd, but not in dir.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Fri Feb 28 14:26:13 2025
    On 28.02.2025 11:19, Richard Heathfield wrote:
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as interesting as
    we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    Actually, this sort of structure was exactly what I thought of
    when you spoke about such huge indent values.


    I don't have such extreme formatting, but structural similar
    variants; elsewhere I had posted this fragment

    if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
    &mutation_rates.base,
    &mutation_rates.genesis,
    &mutation_rates.aging,
    &mutation_rates.death
    ) != 4)

    but I have the habit to not use Tabs for the excess indenting;
    informally written it looks like

    <Tab><Tab>if (sscanf (mutations, "r:%u,g:%u,a:%u,d:%u",
    <Tab><Tab> <spaces> &mutation_rates.base,
    <Tab><Tab> <spaces> &mutation_rates.genesis,
    <Tab><Tab> <spaces> &mutation_rates.aging,
    <Tab><Tab> <spaces> &mutation_rates.death
    <Tab><Tab> <spaces> ) != 4)

    so that the code structure and alignment stays the same when
    changing indent tabs (from 4) to values of, say, 8 or 2.

    The side-effect is that the space-alignment gets not counted
    as [arbitrary long] indents when counting the leading <Tabs>.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Richard Heathfield on Fri Feb 28 14:22:05 2025
    On 28/02/2025 10:19, Richard Heathfield wrote:
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as interesting as
    we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

      value = really_quite_extremely_long_function_name(arg1,
                                                        arg2,
                                                        arg3,
                                                        arg4);

    <sigh>


    I think I'd go with this:

    value = really_quite_extremely_long_function_name(
    arg1,
    arg2,
    arg3,
    arg4);

    Since the args would then also line up with a similar call but where the function name is a different length:

    value2 = a_somewhat_shorter_function_name(
    arg1,
    arg2,
    arg3,
    arg4);

    That's assuming it is still not viable to have them all on the same line.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Richard Harnden on Fri Feb 28 16:44:51 2025
    On 28/02/2025 13:21, Richard Harnden wrote:
    On 28/02/2025 11:54, David Brown wrote:

    I don't go overboard on line length, but I do like to have more room
    than 80 characters, and I don't like hard limits.  One factor in this
    is that a fair bit of my development is in C++ (on small embedded
    systems), and namespaces and classes mean that the average full
    identifier length is a fair amount longer than in C - thus it is
    natural for lines to be longer.

    Have your mental margin-bell ding at around 75 characters, and aim to
    thow a new line as soon a you can?


    No.

    I often have a marker at column 96 on my editor (I find it a nice size
    for documentation - with prose text in documentation, I usually have
    automatic line breaks at that size). But I don't worry about going over
    that on occasion. 75 - 80 characters is far too small.

    Since some people like statistics, I did a quick check on a project with
    31 headers and 30 C files:

    A histogram of the line column count is :

    0 - 9 : 4586 = 18.98%
    10 - 19 : 2021 = 8.36%
    20 - 29 : 2758 = 11.41%
    30 - 39 : 2494 = 10.32%
    40 - 49 : 1677 = 6.94%
    50 - 59 : 1052 = 4.35%
    60 - 69 : 800 = 3.31%
    70 - 79 : 7932 = 32.82%
    80 - 89 : 398 = 1.65%
    90 - 99 : 195 = 0.81%
    100 - 109 : 159 = 0.66%
    110 - 119 : 55 = 0.23%
    120 - 129 : 28 = 0.12%
    130 - 139 : 10 = 0.04%
    150 - 159 : 1 = 0.00%
    Total lines: 24166

    35.78% of lines are over 72 characters, 3.5% are over 80 characters,
    1.28% over 96 characters.

    For a C++ project I checked, about 8.5% of lines are over 80 characters
    and 3.6% are over 96.

    Attempting to limit my coding to 80 characters would make it
    significantly less clear. So I don't do that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to bart on Fri Feb 28 21:55:05 2025
    On 2/28/25 8:22 PM, bart wrote:
    On 28/02/2025 10:19, Richard Heathfield wrote:
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as interesting
    as we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

       value = really_quite_extremely_long_function_name(arg1,
                                                         arg2,
                                                         arg3,
                                                         arg4);

    <sigh>


    I think I'd go with this:

        value = really_quite_extremely_long_function_name(
            arg1,
            arg2,
            arg3,
            arg4);

    Since the args would then also line up with a similar call but where the function name is a different length:

        value2 = a_somewhat_shorter_function_name(
            arg1,
            arg2,
            arg3,
            arg4);

    That's assuming it is still not viable to have them all on the same line.

    I'd probably choose to put the closing ')' on a new line:

    value = really_quite_extremely_long_function_name(
    arg1,
    arg2,
    arg3,
    arg4
    );

    --
    Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to bart on Fri Feb 28 16:34:53 2025
    On Fri, 28 Feb 2025 14:22:05 +0000
    bart <bc@freeuk.com> wrote:

    On 28/02/2025 10:19, Richard Heathfield wrote:
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as
    interesting as we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    <sigh>


    I think I'd go with this:

    value = really_quite_extremely_long_function_name(
    arg1,
    arg2,
    arg3,
    arg4);


    Same here. Except that I'd use even smaller indentation.

    But not for printf(). For printf I prefer
    printf("short format %d+%d+%d=%d\n"
    ,arg1
    ,arg2
    ,arg3
    ,arg4
    );

    When format string is longer I put it on the separate line as well.


    Since the args would then also line up with a similar call but where
    the function name is a different length:

    value2 = a_somewhat_shorter_function_name(
    arg1,
    arg2,
    arg3,
    arg4);

    That's assuming it is still not viable to have them all on the same
    line.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ar Rakin@21:1/5 to Lawrence D'Oliveiro on Fri Feb 28 22:12:40 2025
    On 27 Feb 2025 23:24, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    On Thu, 27 Feb 2025 17:27:17 +0000, bart wrote:

    Problems involving \ and // commonly come up with multi-line macros.

    C macros are yet another example of the wrong way to do macros.

    The only right way to do macros is at the AST level.

    Think how many problems would be solved if you could do gensym in a C
    macro.

    Would you say that the Rust compiler's implementation is *close* to what
    you expect?
    The Rust compiler processes macros during tokenization, so it is not
    exactly what you specified. I am just curious.

    --
    Ar Rakin

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From candycanearter07@21:1/5 to David Brown on Fri Feb 28 17:30:03 2025
    David Brown <david.brown@hesbynett.no> wrote at 09:21 this Friday (GMT):
    On 28/02/2025 05:29, Kaz Kylheku wrote:
    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT): >>>>> lines, /that/ would be a bug.

    The bug, of course, is using Windows and Windows-style paths :-)

    What's worse, its a WONTFIX!

    Not sure what you're talking about. All Microsoft operating systems
    going back to MS-DOS have accepted the forward slash as an alternative
    path separator. C:/Windows/System32 is a legitimate Windows-style path.

    Yes, you can often use forward slashes for directory separations in
    Windows - but you can't do so everywhere. There's no doubt that forward slashes are the standard in the Windows world.

    And, it's obviously the default for most paths.

    Some incorrectly-written user space programs might not like it.


    Indeed - and that can be a pain.

    However, you can certainly use forward slashes in things like #include directives when using gcc on Windows, or in makefiles - and that covers
    a lot of my needs for path names!


    Probably because gcc isn't made by MS.
    --
    user <candycane> is generated from /dev/urandom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to candycanearter07@candycanearter07.n on Fri Feb 28 18:39:29 2025
    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 09:21 this Friday (GMT):
    On 28/02/2025 05:29, Kaz Kylheku wrote:
    On 2025-02-28, candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    David Brown <david.brown@hesbynett.no> wrote at 16:26 this Thursday (GMT): >>>>>> lines, /that/ would be a bug.

    The bug, of course, is using Windows and Windows-style paths :-)

    What's worse, its a WONTFIX!

    Not sure what you're talking about. All Microsoft operating systems
    going back to MS-DOS have accepted the forward slash as an alternative
    path separator. C:/Windows/System32 is a legitimate Windows-style path.

    Yes, you can often use forward slashes for directory separations in
    Windows - but you can't do so everywhere. There's no doubt that forward
    slashes are the standard in the Windows world.

    And, it's obviously the default for most paths.

    There is no "default". The file system does not store any path separator characters it's made of directory objects that point to other
    direcory objects.

    The Win32 functions like CreateFileEx allow path syntax to use either
    kind of slash. Just like MS-DOS did.

    If you're not able to use a forward slash on Windows, it's because some
    program decided that it knows better and is refusing to pass down your
    path to the actual operating system. Or else has some other bug, like a
    "make all directory components" function (a la mkdir -p) or other path manipulation which only breaks on backslashes.

    Fun fact: on some old version of MS-DOS, you could configure COMMAND.COM
    to use forward slashes. There was a user preference variable for it.

    Some incorrectly-written user space programs might not like it.


    Indeed - and that can be a pain.

    However, you can certainly use forward slashes in things like #include
    directives when using gcc on Windows, or in makefiles - and that covers
    a lot of my needs for path names!

    Probably because gcc isn't made by MS.

    I seem to recall that you can use forward slashes just fine in #include directives with Microsoft's C/C++ compiler, CL.EXE.

    Look, back in 2017, someone in the Visual Studio development community complained that autocomplete for #include was generating backslashes:

    https://developercommunity.visualstudio.com/t/use-forward-slashes-by-default-for-includes/170016

    They accepted the issue and fixed it:

    "Thank you for your feedback! We have fixed this issue and it’s
    available in https://www.visualstudio.com/vs/preview Thank you for
    helping us build a better Visual Studio!"

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Richard Heathfield on Fri Feb 28 18:53:59 2025
    On 2025-02-28, Richard Heathfield <rjh@cpax.org.uk> wrote:
    On 28/02/2025 09:21, Janis Papanagnou wrote:
    On 28.02.2025 09:55, Richard Heathfield wrote:
    <snip>

    On the other hand, I maxed out at 24.

    It would be interesting to get to know what sort of code-lines
    or what sort of code-structure these extreme values stem from.

    I thought so too, so I looked, and of course it's not as
    interesting as we might have hoped.

    I'm not allowed to post the code here, but I can paraphrase:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);


    This sort of thing creates a lot of pressure at the 80 column barrier,
    even when the names are not that long, and the nesting is not that deep.

    // 80th col
    value = medium_function_name(arg1, // brick
    not_so_long_name(arg2a, // wall
    arg2b, //
    arg2c),//
    arg3);

    The actual colum I'm hitting here 57, but it only takes a few extra
    indentation levels and slightly longer names before we find ourselves
    at 80.

    I found that working on a project which had a 100 column rule,
    that rule went quite a long way toward relaxing the pressure.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Michael S on Fri Feb 28 21:09:13 2025
    On Fri, 28 Feb 2025 16:34:53 +0200, Michael S wrote:

    When format string is longer I put it on the separate line as well.

    I do that. And of course remember, if you need to, you can split a string literal into multiple pieces on separate lines as well.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Fri Feb 28 21:08:14 2025
    On Fri, 28 Feb 2025 10:19:49 +0000, Richard Heathfield wrote:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    confection = prepare_carefully_according_to_detailed_recipe
    (
    /*pan =*/ flat,
    /*line_with =*/ clarified_butter,
    /*filling =*/ something_yummy,
    /*cover_with =*/ lotsa_pastry,
    /*bake_for =*/ 90 * MINUTES
    );

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Harnden on Fri Feb 28 21:10:31 2025
    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the habit of
    looking at what they were typing?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Michael S on Fri Feb 28 21:14:39 2025
    On Fri, 28 Feb 2025 14:44:42 +0200, Michael S wrote:

    My impression is that even in early days 5:4 was more common than
    square.

    Also A4 (portrait) and A3 (landscape, i.e. 2 × A4 side by side) size ... natural for laying out documents to be printed on paper.

    For many years I use 1200x1920 (yes, portait) as my main monitor at
    work.

    Also note that ratio is 5:8 (or 8:5, turned the other way), which is close
    to the Golden Ratio. I think that is the ideal shape for a multi-purpose computer monitor these days. Pity it is so hard to get.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Fri Feb 28 21:15:48 2025
    On Fri, 28 Feb 2025 10:24:19 +0000, Richard Heathfield wrote:

    ... (and that's proper C, of course, not this newfangled gibberish).

    Do you think it was a bad idea when struct field names went from
    inhabiting a single common name space to each struct having their own?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Ar Rakin on Fri Feb 28 21:25:05 2025
    On Fri, 28 Feb 2025 22:12:40 +0600, Ar Rakin wrote:

    Would you say that the Rust compiler's implementation is *close* to what
    you expect?

    Looking at this overview
    <https://doc.rust-lang.org/book/ch20-06-macros.html>, I think so.

    The Rust compiler processes macros during tokenization ...

    So does C, but Rust does seem to be doing it at the AST level, which is
    the right way.

    But note how they need two types of macros, one involving expanding a
    template and the other allowing the more elaborate execution of arbitrary
    code. In LISP-family languages (where the idea of AST-level macros came
    from), there doesn’t need to be such a distinction.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Lawrence D'Oliveiro on Fri Feb 28 22:15:31 2025
    On 28/02/2025 21:15, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 10:24:19 +0000, Richard Heathfield wrote:

    ... (and that's proper C, of course, not this newfangled gibberish).

    Do you think it was a bad idea when struct field names went from
    inhabiting a single common name space to each struct having their own?

    I like my porridge not too hot and not too cold, but just right.
    C90 porridge tastes just fine to me.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Fri Feb 28 22:38:45 2025
    On Fri, 28 Feb 2025 22:15:31 +0000, Richard Heathfield wrote:

    C90 porridge tastes just fine to me.

    Come on, C99 at least. Declare-anywhere-before-use, stdbool, better IEEE
    754 support ... and don’t forget the wonderful “#include <iso646.h>”!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Lawrence D'Oliveiro on Fri Feb 28 23:21:47 2025
    On 28/02/2025 22:38, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 22:15:31 +0000, Richard Heathfield wrote:

    C90 porridge tastes just fine to me.

    Come on, C99 at least.

    Back porch preacher preaching at me
    Acting like he wrote the golden rule
    Shaking his fist and speeching at me
    Shouting from his soap box like a fool

    Clean up your own backyard
    Oh don't you hand me none of your lines
    Clean up your own backyard
    You tend to your business, I'll tend to mine.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    The King is dead. Long live the King.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Lawrence D'Oliveiro on Fri Feb 28 23:32:29 2025
    On 28/02/2025 21:10, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the habit of looking at what they were typing?

    Exactly. They didn't need to look at what they were typing, because
    they could touch-type. It's why the F and J keys have the little bumps
    - so you'd know where you were. They'd be looking only at what they
    where copying, so the audible cue was necessary. They could hit 90+
    words per minute.

    Very impressive, but not a skill a programmer needs.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Richard Harnden on Fri Feb 28 23:49:54 2025
    On 28/02/2025 23:32, Richard Harnden wrote:
    On 28/02/2025 21:10, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the
    habit of
    looking at what they were typing?

    Exactly.  They didn't need to look at what they were typing,
    because they could touch-type.  It's why the F and J keys have
    the little bumps - so you'd know where you were.  They'd be
    looking only at what they where copying, so the audible cue was
    necessary.  They could hit 90+ words per minute.

    Very impressive, but not a skill a programmer needs.

    MMMV.

    You do you, obviously, but touch-typing can easily double your
    typing speed. It never ceases to amaze me that the NHS claims
    their doctors are overworked but can't be arsed to teach them to
    touch-type.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Harnden on Sat Mar 1 02:55:25 2025
    On Fri, 28 Feb 2025 23:32:29 +0000, Richard Harnden wrote:

    On 28/02/2025 21:10, Lawrence D'Oliveiro wrote:

    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the habit of
    looking at what they were typing?

    They didn't need to look at what they were typing, because
    they could touch-type.

    Touch-typing means not having to look at the keyboard. It doesn’t mean not looking at what you're typing.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Keith Thompson on Sat Mar 1 01:02:36 2025
    On 01/03/2025 00:15, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 28/02/2025 23:32, Richard Harnden wrote:
    On 28/02/2025 21:10, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the habit
    of
    looking at what they were typing?
    Exactly.  They didn't need to look at what they were typing, because
    they could touch-type.  It's why the F and J keys have the little
    bumps - so you'd know where you were.  They'd be looking only at
    what they where copying, so the audible cue was necessary.  They
    could hit 90+ words per minute.
    Very impressive, but not a skill a programmer needs.

    MMMV.

    You do you, obviously, but touch-typing can easily double your typing
    speed. It never ceases to amaze me that the NHS claims their doctors
    are overworked but can't be arsed to teach them to touch-type.

    I suspect two different points are being made. Touch-typing without
    looking at the keyboard is important for programmers. Touch-typing
    without looking at the text being typed is less so.


    Yes. I don't need to look at my fingers/the keyboard, but I do need to concentrate on the code. Give me a azerty layout and I'm back to one
    finger and searching.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Sat Mar 1 02:56:32 2025
    On Fri, 28 Feb 2025 23:21:47 +0000, Richard Heathfield wrote:

    On 28/02/2025 22:38, Lawrence D'Oliveiro wrote:

    On Fri, 28 Feb 2025 22:15:31 +0000, Richard Heathfield wrote:

    C90 porridge tastes just fine to me.

    Come on, C99 at least.

    Clean up your own backyard ...

    Been there, done that. I practise what I preach.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Sat Mar 1 07:07:56 2025
    On 28.02.2025 12:54, David Brown wrote:

    Splitting is fine here - it is natural and fits the flow of the code.
    [...]
    But that is perhaps just splitting hairs :-)

    Nice pun! :-)


    I also have two 24" screens (on this computer), and my eyes are also not
    as good as they used to be. (In my youth, I used to write my notes on
    2mm graph paper - normal lined paper seemed a waste of space to me.)

    :-)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Lawrence D'Oliveiro on Sat Mar 1 06:17:25 2025
    On 01/03/2025 02:56, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 23:21:47 +0000, Richard Heathfield wrote:

    On 28/02/2025 22:38, Lawrence D'Oliveiro wrote:

    On Fri, 28 Feb 2025 22:15:31 +0000, Richard Heathfield wrote:

    C90 porridge tastes just fine to me.

    Come on, C99 at least.

    Clean up your own backyard ...

    Been there, done that. I practise what I preach.

    <whoosh!>

    You tend to your business, I'll tend to mine.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Sat Mar 1 17:30:29 2025
    On 01/03/2025 01:15, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 28/02/2025 23:32, Richard Harnden wrote:
    On 28/02/2025 21:10, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 12:21:01 +0000, Richard Harnden wrote:

    Have your mental margin-bell ding at around 75 characters ...

    What was the ding for? Was it because typists were not in the habit
    of
    looking at what they were typing?
    Exactly.  They didn't need to look at what they were typing, because
    they could touch-type.  It's why the F and J keys have the little
    bumps - so you'd know where you were.  They'd be looking only at
    what they where copying, so the audible cue was necessary.  They
    could hit 90+ words per minute.
    Very impressive, but not a skill a programmer needs.

    MMMV.

    You do you, obviously, but touch-typing can easily double your typing
    speed. It never ceases to amaze me that the NHS claims their doctors
    are overworked but can't be arsed to teach them to touch-type.

    I suspect two different points are being made. Touch-typing without
    looking at the keyboard is important for programmers. Touch-typing
    without looking at the text being typed is less so.


    That later skill is really useful for impressing and/or annoying people
    who come into your office to talk to you when you are busy. Try it some
    time - look at them and even reply to them without stopping typing.

    (You can go back and correct mistakes when they are gone!)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Lawrence D'Oliveiro on Sat Mar 1 17:32:54 2025
    On 28/02/2025 22:08, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 10:19:49 +0000, Richard Heathfield wrote:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    confection = prepare_carefully_according_to_detailed_recipe
    (
    /*pan =*/ flat,
    /*line_with =*/ clarified_butter,
    /*filling =*/ something_yummy,
    /*cover_with =*/ lotsa_pastry,
    /*bake_for =*/ 90 * MINUTES
    );

    I get the impression that you work alone.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Sat Mar 1 20:25:26 2025
    On Sat, 1 Mar 2025 06:17:25 +0000, Richard Heathfield wrote:

    You tend to your business, I'll tend to mine.

    Next time, be more careful about using phrases like “newfangled gibberish” in public.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Sat Mar 1 21:32:59 2025
    On 01.03.2025 17:32, David Brown wrote:
    On 28/02/2025 22:08, Lawrence D'Oliveiro wrote:
    On Fri, 28 Feb 2025 10:19:49 +0000, Richard Heathfield wrote:

    value = really_quite_extremely_long_function_name(arg1,
    arg2,
    arg3,
    arg4);

    confection = prepare_carefully_according_to_detailed_recipe
    (
    /*pan =*/ flat,
    /*line_with =*/ clarified_butter,
    /*filling =*/ something_yummy,
    /*cover_with =*/ lotsa_pastry,
    /*bake_for =*/ 90 * MINUTES
    );

    I get the impression that you work alone.

    My guess is that this form is just an informal syntax mimicking Perl's
    function parameter passing as hash with the passed values associated
    with the formal parameter names in the call. - You know; he's a Perl
    fan. - Of course it's one thing if a language supports such parameter
    passing mechanisms or if you just make it look like that but without
    actually getting the (indeed neat) mechanism [that you have in Perl].

    So this not only looks bad (in "C") but also doesn't work as desired.

    In C++ we could use specific argument objects to support defaults and
    any argument order, but in "C" it would probably get yet more clumsy
    to support that.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Lawrence D'Oliveiro on Sat Mar 1 21:03:26 2025
    On 01/03/2025 20:25, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 06:17:25 +0000, Richard Heathfield wrote:

    You tend to your business, I'll tend to mine.

    Next time, be more careful about using phrases like “newfangled gibberish”
    in public.

    I hope you're not implying I used the phrase carelessly.

    I predict a confrontational reply, to which I will do the group
    the courtesy of not responding. Fill your boots.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Sat Mar 1 22:20:34 2025
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking Perl's function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Sat Mar 1 22:21:12 2025
    On Sat, 1 Mar 2025 21:03:26 +0000, Richard Heathfield wrote:

    On 01/03/2025 20:25, Lawrence D'Oliveiro wrote:

    On Sat, 1 Mar 2025 06:17:25 +0000, Richard Heathfield wrote:

    You tend to your business, I'll tend to mine.

    Next time, be more careful about using phrases like “newfangled
    gibberish” in public.

    I hope you're not implying I used the phrase carelessly.

    That became apparent during the discussion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Sat Mar 1 23:43:38 2025
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking Perl's
    function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    Janis, curious

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Keith Thompson on Sun Mar 2 02:42:39 2025
    On Sat, 01 Mar 2025 17:24:58 -0800, Keith Thompson wrote:

    If I wanted to annotate arguments with parameter names, I'd probably use aligned // comments with the name at the end of the line:

    confection = prepare_carefully_according_to_detailed_recipe(
    flat, // pan
    clarified_butter, // line_with
    something_yummy, // filling
    lotsa_pastry, // cover_with
    90 * MINUTES // bake_for
    );

    Then they end up the wrong way round.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Michael S on Sat Mar 1 21:30:27 2025
    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 10:24:19 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 28/02/2025 09:22, David Brown wrote:

    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's proper
    C, of course, not this newfangled gibberish).

    one man's newfangled gibberish is another man's proper C

    +1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Keith Thompson on Sat Mar 1 21:29:29 2025
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:

    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking
    Perl's function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983. [...]

    The programming language Mesa had keyword arguments sometime in
    the mid 1970s.

    The job control language JCL had keyword arguments in the 1960s.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to bart on Sat Mar 1 21:56:47 2025
    bart <bc@freeuk.com> writes:

    On 27/02/2025 12:56, Ar Rakin wrote:

    [concerning line splicing with \ at end of line]

    Then line-splicing, which combines two lines if the first ends
    with \, is done before processing // comments.

    I am aware that you can do the same thing with strings like this:

    fprintf(stderr, "multi\
    line\
    strings\
    are fun.");

    I can understand how this might be useful; but with *comments*??
    Was that actually a thing in the official C standards?

    It's isn't that useful for strings; the following is simpler and
    also works:

    "multi"
    "line"
    "string"

    Just as a historical note, this construction wasn't available in
    pre-standard C. So line splicing used to be needed in such cases.

    But it is needed for multi-line macros, as C's proprocessor is
    strictly line-oriented and a macro definition must fit onto one
    line.

    Since 1989 when the original C standard was done, multi-line macros
    can be written without needing to use \ for line splicing. I was
    surprised to learn this when I first saw it. An example:

    #define MASK_WIDTH( m ) ( 0U + (unsigned)+( /*
    */ (m) /((m)%32767 +1) /32767 %32767 *15 /*
    */ + (m) %32767 /((m)%31 +1) /31 %31 *5 /*
    */ + 4 - 12 / ((m)%31 + 3) /*
    */))

    Yes, it's ugly. Yes, it means line breaks can be put in only at
    token boundaries (although in practice that limitation is observed
    anyway). Yes, I know of no production code that uses this
    technique. Still I think this trick is one worth knowing about.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Sun Mar 2 06:48:19 2025
    On 02.03.2025 02:24, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:
    My guess is that this form is just an informal syntax mimicking Perl's >>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983. [...]

    Back these day I had just a peek into Ada, never programmed with it.
    (It appears to me to have it supported very nicely.)


    The syntax is IMHO much nicer than using /*...*/ comments in C.

    I think the "C"-comments are horrible, especially for that purpose;
    I'd never do it that way.

    (Though, I understand the individual impetus to mimic unsupported
    features known from other languages.)

    [...]

    Perl doesn't have keyword arguments as a language feature, but it can be mimicked by passing hash or hash reference.

    Yes, that's how I perceived it. As a syntax pattern it's okay, IMO.
    At least it's functional and not only informal (as with comments).


    If I wanted to annotate arguments with parameter names, I'd probably use aligned // comments with the name at the end of the line:

    confection = prepare_carefully_according_to_detailed_recipe(
    flat, // pan
    clarified_butter, // line_with
    something_yummy, // filling
    lotsa_pastry, // cover_with
    90 * MINUTES // bake_for
    );

    In practice, I seldom do so unless there's direct language support.

    Yep.

    And thanks for the hint to Ada.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Sun Mar 2 00:21:23 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    Kaz Kylheku <643-408-1753@kylheku.com> writes:

    On 2025-02-26, Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:

    Sorry, I should have showed this difference in my original post.
    I like the GNU style except the weird indentation before the
    braces of control statements. Not sure why they choose to indent
    that way.

    The GNU style without indent before braces looks nice to me.

    Without the weird brace indent, it has nothing to do with GNU any
    more; it's just two-space indentation, where opening braces are on
    their own line instead of being "cuddled" into the previous line,
    which is very common:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    There's so much vertical space wasted in that, however.

    if (flag && (state == 42)) state = 73;
    else statement;

    The suggested rewrite has different semantics. Instead

    if(flag) state = state == 42 ? 73 : state;
    else statement;

    or

    if(flag) state != 42 || (state = 73);
    else statement;

    has the same behavior as the original. (Disclaimer: not
    compiled.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Sun Mar 2 00:49:39 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    [using // instead of /* ... */ to comment out lines of code]

    I disagree with this. A line of code should never be commented
    out; simply removed if not necessary.

    During development it can be useful to comment out one or
    more lines of code, but leave the commented lines in the
    source file. The point is we don't always know what is
    necessary and what isn't. What matters when code is
    finished and ready to be shipped is not the same as what
    matters when code is in the process of being developed.
    That distinction also applies to other things besides
    whether to remove certain lines of code or just comment
    them out.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Michael S on Sun Mar 2 09:29:37 2025
    On 28/02/2025 12:19, Michael S wrote:
    On Fri, 28 Feb 2025 10:24:19 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 28/02/2025 09:22, David Brown wrote:

    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's proper
    C, of course, not this newfangled gibberish).


    one man's newfangled gibberish is another man's proper C

    Agreed. On the other hand, it is easy to overlook the virtue of
    stability, and change does not necessarily imply progress.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to David Brown on Sun Mar 2 09:35:01 2025
    On 28/02/2025 12:03, David Brown wrote:
    On 28/02/2025 11:24, Richard Heathfield wrote:
    On 28/02/2025 09:22, David Brown wrote:
    On 27/02/2025 22:24, Keith Thompson wrote:
    Richard Heathfield <rjh@cpax.org.uk> writes:
    On 27/02/2025 12:56, Ar Rakin wrote:
    bart <bc@freeuk.com> writes:

    // isn't devoid of quirks (this is still C after all), for
    example:

         fopen(file,"rb");   // open file in \windows\system32\ >>>>>>>      fread(...);

    Here, the // line continues onto the next, so that the
    fread is
    commented out. But they are fewer.
    Interesting. Isn't this considered a compiler bug?

    No. Line splicing occurs in Translation Phase 2. Comment
    removal
    doesn't happen until Translation Phase3. If a compiler
    /didn't/ splice
    those lines, /that/ would be a bug.

    <OT>Long time no see.  Welcome back!</OT>


    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's
    proper C, of course, not this newfangled gibberish).


    LaTeX is great when it's all going well, but sometimes macros can
    get pretty hairy - I've written more than my share of unreadable
    macro code.  There's also the risk that you spend so much time
    examining the microtyping and ligature generation at 1600% zoom
    on the pdf reader, that you don't have time to write the documents!

    Quite. Have you ever given up entirely and settled for a
    re-wording? That's my t-shirt.

    Still, LaTeX (or LuaLaTeX, as I use these days) is better than
    anything else I know of.

    One of its best features is *not* allowing footnotes to have
    footnotes. This feature has saved not only many hours but quite
    possibly my eyesight.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Keith Thompson on Sun Mar 2 11:31:48 2025
    On 02/03/2025 01:24, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:
    My guess is that this form is just an informal syntax mimicking Perl's >>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983. The following are all
    equivalent, given that Foo takes integer arguments Arg1 and Arg2:

    Foo(Arg1 => 10, Arg2 => 20);
    Foo(Arg2 => 20, Arg1 => 10);
    Foo(10, Arg2 => 20);
    Foo(10, 20);

    The syntax is IMHO much nicer than using /*...*/ comments in C.

    Does it have optional arguments with default values? IMO keyword
    arguments are much less useful without that feature/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Sun Mar 2 12:52:20 2025
    On 02/03/2025 02:24, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:
    My guess is that this form is just an informal syntax mimicking Perl's >>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983. The following are all
    equivalent, given that Foo takes integer arguments Arg1 and Arg2:

    Foo(Arg1 => 10, Arg2 => 20);
    Foo(Arg2 => 20, Arg1 => 10);
    Foo(10, Arg2 => 20);
    Foo(10, 20);

    The syntax is IMHO much nicer than using /*...*/ comments in C.


    Ada (and Python - no idea about Perl) named parameter passing have two
    huge advantages over comments like Lawrence uses - one is that they let
    you order the parameters in what you see as a logical manner at the call
    source (especially useful combined with default parameters), and the
    other is that the whole thing is checked by the compiler. If the
    function's signature is changed, parameters re-ordered or renamed, the
    call source is either still correct or there is a hard compile-time
    error. With comment-based naming, all you have done is guaranteed that
    the call source looks correct but is wrong. Using comments like
    Lawrence does is significant extra effort (especially to keep it in sync
    with changes), and can't be trusted. It's all cost and no gain.

    Named parameters are a useful tool when the language provides them, but
    useless when done with comments.

    If someone wants to have the benefits of named parameter passing in C,
    then using a struct for the arguments along with designated initialisers
    and compound literals is a much better way. Individual types for the
    different parameters also works (wrapping the desired types in structs).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Ar Rakin on Sun Mar 2 04:01:33 2025
    Ar Rakin <rakinar2@onesoftnet.eu.org> writes:

    Hello there,

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the
    most?

    [...]

    3. Other Styles?

    Please show an example!

    The question being asked is mostly about indentation and placement
    of braces. There are a few points here that I think are worth
    making.

    One, simply asking for a preference or an opinion is a waste of
    time. The question is not what choices are preferred but what
    factors motivate the choices made (example to be given below).

    Two, it's just as useless to say a particular layout is "more clear"
    or "more readable".

    Three, the idea that it's all just opinions or personal preferences
    is cowardly. In effect the message there is that any opinion is
    equally valuable. That is not the case.

    Four, there are lots of different layout choices used widely enough
    to have recognized communities of adherents. Here is a list
    constructed from the wikipedia page on indentation style:

    1TBS aka One True Brace Style
    BSD aka Allman
    BSD KNF ("kernel normal form")
    "FORTRAN" (no indentation)
    GNU
    Horstmann
    Java-like
    K&R
    Linux Kernel
    "Lispish" (C as it might be written by a Lisp programmer)
    Pico
    Ratliff
    Stroustrup
    Whitesmiths

    Note: as best I can tell the principal difference between K&R
    and 1TBS is K&R allows single-statement bodies of if() and
    while(), etc, to be given indented on the next line, without
    any braces, whereas 1TBS insists on braces in such cases.

    The layout style I personally prefer is closest to 1TBS. As it
    turns out I tried lots of different layout choices, and ended up
    on a 1TBS-like pattern, years before I ever learned C. That's a
    data point but it doesn't really convey much information, in line
    with my earlier statement in point One.

    Five, an example. Consider a decision with only one degree of
    freedom: for the start of a function definition, should we write
    this

    size_t length_of_string( const char *s ){

    or this

    size_t
    length_of_string( const char *s ){

    (ignoring other layout choices as being incidental to the
    question here).

    There are three areas of consideration:

    (a) effects on development-time activity
    (b) effects on code-reading or code-inspection activity
    (c) effects on the source code itself.

    For (c), the one-line style uses one fewer lines, but has a
    higher chance of needing to split the function parameters across
    a line boundary.

    For (a), the two-line style lends itself to searching using
    standard editor tools

    For (b), the two-line style
    (1) makes it easy to find both names of functions and types
    of functions using just my eyes (fast thinking) without
    having to parse the symbols involved and separate them
    (slow thinking); slow thinking uses more energy and
    mental effort than fast thinking
    (2) related to (1), the same holds true for reading on
    hardcopy rather than a display
    (3) is easier to process using simple tools such as grep
    or awk
    (4) gives an increase in code size, probably in the range
    of 5 to 10 percent, which means programs are longer
    and take up more "space" on an output medium (which
    may affect reading time)

    Of the factors listed, probably the largest effect is due to
    being able to find function names and types visually, rather than
    having to use higher level brain functions. The cost of longer
    program source is significant, but in my experience that is more
    than outweighed by the savings in energy and mental effort used
    when reading and developing.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Tim Rentsch on Sun Mar 2 13:21:00 2025
    On 02/03/2025 09:21, Tim Rentsch wrote:
    scott@slp53.sl.home (Scott Lurndal) writes:

    Kaz Kylheku <643-408-1753@kylheku.com> writes:

    On 2025-02-26, Ar Rakin <rakinar2@onesoftnet.eu.org> wrote:

    Sorry, I should have showed this difference in my original post.
    I like the GNU style except the weird indentation before the
    braces of control statements. Not sure why they choose to indent
    that way.

    The GNU style without indent before braces looks nice to me.

    Without the weird brace indent, it has nothing to do with GNU any
    more; it's just two-space indentation, where opening braces are on
    their own line instead of being "cuddled" into the previous line,
    which is very common:

    if (flag)
    {
    switch (state)
    {
    case 42:
    {
    state = 73;
    break;
    }
    }
    }
    else
    {
    statement;
    }

    There's so much vertical space wasted in that, however.

    if (flag && (state == 42)) state = 73;
    else statement;

    The semantics here are different, yes - if "flag" is true and "state" is
    not 42, the original version does not run "statement;" while the
    re-write does run it.


    The suggested rewrite has different semantics. Instead

    if(flag) state = state == 42 ? 73 : state;
    else statement;


    The semantics here are different from the original - introducing a
    spurious write to "state" could be observable behaviour or subject to an additional data race if "state" is "volatile", atomic, or interacts with
    other threads.

    or

    if(flag) state != 42 || (state = 73);
    else statement;

    has the same behavior as the original. (Disclaimer: not
    compiled.)

    The semantics here are also possibly different from the original if
    "state" is volatile or atomic. The details of volatile accesses are implementation-defined - the evaluation "(state = 73)" with a volatile
    "state" may re-read "state" after the assignment, or may not.

    Re-writes of code can have subtle complications when you don't know the
    full context. This is one reason people working on serious and
    safety-critical software don't faff around with expressions like those
    ones, and prefer clear and unambiguous code that can't be misinterpreted
    by other programmers, or compilers, regardless of the circumstances. If
    you want to eliminate the switch, consider this :

    if (flag) {
    if (state == 42) {
    state = 73;
    }
    } else {
    statement;
    }


    Yes, it is more verbose - but it is absolutely clear, and there is no
    doubt what is going on even if there are volatiles, atomics, or threads involved.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to David Brown on Sun Mar 2 13:42:27 2025
    On 02/03/2025 11:52, David Brown wrote:
    On 02/03/2025 02:24, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:
    My guess is that this form is just an informal syntax mimicking Perl's >>>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983.  The following are all
    equivalent, given that Foo takes integer arguments Arg1 and Arg2:

         Foo(Arg1 => 10, Arg2 => 20);
         Foo(Arg2 => 20, Arg1 => 10);
         Foo(10, Arg2 => 20);
         Foo(10, 20);

    The syntax is IMHO much nicer than using /*...*/ comments in C.


    Ada (and Python - no idea about Perl) named parameter passing have two
    huge advantages over comments like Lawrence uses - one is that they let
    you order the parameters in what you see as a logical manner at the call source (especially useful combined with default parameters), and the
    other is that the whole thing is checked by the compiler.  If the
    function's signature is changed, parameters re-ordered or renamed, the
    call source is either still correct or there is a hard compile-time
    error.  With comment-based naming, all you have done is guaranteed that
    the call source looks correct but is wrong.  Using comments like
    Lawrence does is significant extra effort (especially to keep it in sync
    with changes), and can't be trusted.  It's all cost and no gain.

    Named parameters are a useful tool when the language provides them, but useless when done with comments.

    If someone wants to have the benefits of named parameter passing in C,
    then using a struct for the arguments along with designated initialisers
    and compound literals is a much better way.  Individual types for the different parameters also works (wrapping the desired types in structs).
    I've seen examples of emulating named parameters in C using structs.
    They had multiple issues:

    * Having to invent auxiliary struct types for each kind of function
    signature

    * Having to rewrite function bodies to access parameters as struct
    elements instead

    * (Within the implementation, probably having to set up then copy the
    struct to preserve value-passing semantics)

    * At the call-site, needing to use an ugly, cluttered syntax involving
    compound literals and designated initialisers, a lot worse than the
    example with /**/ comments

    * Being limited in the default values for omitted arguments, which can
    only be zeros

    * Not being able to superimpose named parameters on imported functions
    of existings libraries, since they require the function source code to
    be revised and recompiled. (In my implementations of the feature, this
    is possible, while none of the above drawbacks apply.)

    It's better to accept that the language doesn't have the feature.

    However, it is similar to designated initialisers, and would have been a
    much more useful feature for C99.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Janis Papanagnou on Sun Mar 2 06:00:13 2025
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 26.02.2025 12:53, Ar Rakin wrote:

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    Re "goofy style"; I've seen someone preferring

    while (q(a,b))
    {
    a=b;
    f(x);
    if (c>d)
    {
    g(y);
    }
    }

    To each his own.

    That looks like a nightmare for the code reviewers.

    I cannot tell where that comes from; the person who uses it is an experienced Perl programmer - may that be some convention in that
    specific language context? (I can't tell.)

    It's called Whitesmith (Whitesmiths?) style. It is (or was?)
    used in PJ Plauger's company, who IIANM among other things wrote
    one of the first C compilers done outside of Bell Labs.

    For those who don't recognize the name, PJ Plauger was involved
    in C standardization efforts from an early date, and was a member
    of WG14 for more than 20 years even after the first C standard
    was published.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Janis Papanagnou on Sun Mar 2 05:52:07 2025
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:

    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I
    frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    This measurement is an interesting idea.

    Gathering some statistics from what I expect is typical source for
    my own code, and ignoring: blank lines; lines that are flush left;
    and "non-code" lines; I get

    level percent percentile
    ===== ======= ==========
    1 69.6 69.6
    2 27.0 96.5
    3 2.2 98.7
    4 0.9 99.6
    5 0.4 100.0

    giving an average indentation of 1.36 levels. The numbers shown are
    calculated by considering the amount of leading white space in each line,
    and rounding up to an integral multiple of one indent level (which
    is four columns).

    There were some lines that had larger amounts of leading white
    space, but they were not lines that reflect normal indenting.

    What would be your typical indent distribution in your "C" source code?

    Probably the numbers I gave above are typical. In most cases the
    code I write is very flat.

    For comparison here are the percentages for the previous list of
    numbers:

    level percent percentile
    ===== ======= ==========
    1 39.8 39.8
    2 27.0 66.8
    3 19.1 85.9
    4 7.2 93.1
    5 5.3 98.4
    6 1.1 99.5
    7 0.5 100.0

    giving an average indentation of 2.16 levels.

    [a bunch of stuff about line widths]

    I almost never write C code with lines wider than 80 columns. The
    numbers shown above are gathered from source with all lines not more
    than 80 columns.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Tim Rentsch on Sun Mar 2 16:20:07 2025
    On Sun, 02 Mar 2025 06:00:13 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 26.02.2025 12:53, Ar Rakin wrote:

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    Re "goofy style"; I've seen someone preferring

    while (q(a,b))
    {
    a=b;
    f(x);
    if (c>d)
    {
    g(y);
    }
    }

    To each his own.

    That looks like a nightmare for the code reviewers.

    I cannot tell where that comes from; the person who uses it is an experienced Perl programmer - may that be some convention in that
    specific language context? (I can't tell.)

    It's called Whitesmith (Whitesmiths?) style. It is (or was?)
    used in PJ Plauger's company, who IIANM among other things wrote
    one of the first C compilers done outside of Bell Labs.

    For those who don't recognize the name, PJ Plauger was involved
    in C standardization efforts from an early date, and was a member
    of WG14 for more than 20 years even after the first C standard
    was published.

    In his younger years he was rather well-regarded SF author.
    In his more advanced years specialized on supplying STL to C++ compiler vendors.
    I wonder what he is doing after entering 9th decade.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Tim Rentsch on Sun Mar 2 14:21:13 2025
    On 02/03/2025 13:52, Tim Rentsch wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:

    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I
    frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or
    develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of
    indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    This measurement is an interesting idea.

    Gathering some statistics from what I expect is typical source for
    my own code, and ignoring: blank lines; lines that are flush left;
    and "non-code" lines; I get

    level percent percentile
    ===== ======= ==========
    1 69.6 69.6
    2 27.0 96.5
    3 2.2 98.7
    4 0.9 99.6
    5 0.4 100.0

    giving an average indentation of 1.36 levels. The numbers shown are calculated by considering the amount of leading white space in each line,
    and rounding up to an integral multiple of one indent level (which
    is four columns).

    I tried it on a non-C project and the results were:

    Level Count Percentage

    1 11843 52%
    2 6659 29%
    3 3016 13%
    4 1016 4%
    5 366 2%
    6 79 0%
    7 15 0%

    Total 22994 100%

    Total project size was 29K lines. Comments are ignored. Level 0 lines
    are ignored.

    All function bodies are indented one level anyway, so half the lines
    aren't indented at all relative to the baseline.

    The highest indent is 7, but since tabs are 4 spaces, those lines only
    start 28 characters in from the left, in a 100-char window. That's 24 characters beyond the 'baseline'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Michael S on Sun Mar 2 15:53:15 2025
    On 02.03.2025 15:20, Michael S wrote:
    On Sun, 02 Mar 2025 06:00:13 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    It's called Whitesmith (Whitesmiths?) style. It is (or was?)
    used in PJ Plauger's company, who IIANM among other things wrote
    one of the first C compilers done outside of Bell Labs.

    For those who don't recognize the name, PJ Plauger was involved
    in C standardization efforts from an early date, and was a member
    of WG14 for more than 20 years even after the first C standard
    was published.

    I know him and his reputation but nonetheless don't like that
    formatting style. - But thanks for letting us know the source.

    In his younger years he was rather well-regarded SF author.

    (Never heard of his SF writings. But there's so many SF authors
    and yet more different SF styles, and preferences vary anyway.)

    In his more advanced years specialized on supplying STL to C++ compiler vendors.

    I sort of know him from (I think) a C++ standard library book;
    I thought it was earlier in the 90's but it was maybe this one:
    "The Draft Standard C++ Library" (1995). - I don't think that
    above mentioned formatting style was advertised in this book.
    (But I've only faint memories here.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to John McCue on Sun Mar 2 06:22:52 2025
    John McCue <jmccue@reddwf.jmcunx.com> writes:

    FWIW, people really should learn to use indent(1), will help
    with many of these arguments :) [...]

    My experience with source code formatters is they always do too
    much, throwing away important information. Another problem is
    limited flexibility - even the enormous set of configuration
    parameters doesn't cover styles outside of a rather limited set
    of choices.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Janis Papanagnou on Sun Mar 2 16:32:01 2025
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking Perl's
    function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    VAX-11 Pascal supported it (and a form of comment that you would dislike).

    Total_memory := 0;
    REPEAT
    Ss_status := $GETJPI( PIDADR := Wild_pid, EFN := 4, ITMLST := Jpi_list );
    IF ODD( Ss_status ) AND (Terminal_len <> 0) THEN
    BEGIN
    $WAITFR( 4 ); { Wait for asynch stuff to return }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Scott Lurndal on Sun Mar 2 17:50:07 2025
    On 02.03.2025 17:32, Scott Lurndal wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking Perl's >>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    VAX-11 Pascal supported it (and a form of comment that you would dislike).

    Interesting. (I didn't know that DEC supported a Pascal dialect.)

    WRT that comment; I think that {...} is not worse than the (*...*)
    variant we often see. - The main point is, though, how it fits in
    the language. - "C" is already full of punctuation characters, and
    especially the '*' is existing in many contexts. Pascal, OTOH, is
    very text-biased; so its two comment variants don't annoy [me] too
    much. (The "open end" comment property is not dominating here.)


    Total_memory := 0;
    REPEAT
    Ss_status := $GETJPI( PIDADR := Wild_pid, EFN := 4, ITMLST := Jpi_list );
    IF ODD( Ss_status ) AND (Terminal_len <> 0) THEN
    BEGIN
    $WAITFR( 4 ); { Wait for asynch stuff to return }


    What's that '$' preceding the function names? (I don't recall that
    from the Pascal standard or from the versions I programmed with.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to bart on Sun Mar 2 19:04:04 2025
    On 02/03/2025 14:42, bart wrote:
    On 02/03/2025 11:52, David Brown wrote:
    On 02/03/2025 02:24, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:
    My guess is that this form is just an informal syntax mimicking
    Perl's
    function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    For example, it exists in Ada since 1983.  The following are all
    equivalent, given that Foo takes integer arguments Arg1 and Arg2:

         Foo(Arg1 => 10, Arg2 => 20);
         Foo(Arg2 => 20, Arg1 => 10);
         Foo(10, Arg2 => 20);
         Foo(10, 20);

    The syntax is IMHO much nicer than using /*...*/ comments in C.


    Ada (and Python - no idea about Perl) named parameter passing have two
    huge advantages over comments like Lawrence uses - one is that they
    let you order the parameters in what you see as a logical manner at
    the call source (especially useful combined with default parameters),
    and the other is that the whole thing is checked by the compiler.  If
    the function's signature is changed, parameters re-ordered or renamed,
    the call source is either still correct or there is a hard
    compile-time error.  With comment-based naming, all you have done is
    guaranteed that the call source looks correct but is wrong.  Using
    comments like Lawrence does is significant extra effort (especially to
    keep it in sync with changes), and can't be trusted.  It's all cost
    and no gain.

    Named parameters are a useful tool when the language provides them,
    but useless when done with comments.

    If someone wants to have the benefits of named parameter passing in C,
    then using a struct for the arguments along with designated
    initialisers and compound literals is a much better way.  Individual
    types for the different parameters also works (wrapping the desired
    types in structs).
    I've seen examples of emulating named parameters in C using structs.
    They had multiple issues:

    * Having to invent auxiliary struct types for each kind of function
    signature

    * Having to rewrite function bodies to access parameters as struct
    elements instead

    * (Within the implementation, probably having to set up then copy the
    struct to preserve value-passing semantics)

    * At the call-site, needing to use an ugly, cluttered syntax involving compound literals and designated initialisers, a lot worse than the
    example with /**/ comments

    * Being limited in the default values for omitted arguments, which can
    only be zeros

    * Not being able to superimpose named parameters on imported functions
    of existings libraries, since they require the function source code to
    be revised and recompiled. (In my implementations of the feature, this
    is possible, while none of the above drawbacks apply.)


    Sure.

    But despite all that, it is still better than an obsessive use of
    comments in the form Lawrence uses (or promotes) - at least mistakes and inconsistencies are caught at compile-time.

    And the alternative I gave - using individual struct wrappers for each parameter - has related disadvantages. (It's a good deal less bad in
    C++ than in C, but still not nearly as nice as real named parameters
    would be.)

    It's better to accept that the language doesn't have the feature.


    Agreed.

    However, it is similar to designated initialisers, and would have been a
    much more useful feature for C99.

    I'd like to see named function parameters as part of C. But I'm not
    holding my breath waiting for them!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Janis Papanagnou on Sun Mar 2 18:28:42 2025
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 02.03.2025 17:32, Scott Lurndal wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 01.03.2025 23:20, Lawrence D'Oliveiro wrote:
    On Sat, 1 Mar 2025 21:32:59 +0100, Janis Papanagnou wrote:

    My guess is that this form is just an informal syntax mimicking Perl's >>>>> function parameter passing ...

    The idea of passing arguments by keyword predates Perl.

    That wouldn't surprise me. - I know it from Perl. - Which other
    (earlier) languages do you have in mind? - What's its origin?

    VAX-11 Pascal supported it (and a form of comment that you would dislike).

    Interesting. (I didn't know that DEC supported a Pascal dialect.)

    WRT that comment; I think that {...} is not worse than the (*...*)
    variant we often see. - The main point is, though, how it fits in
    the language. - "C" is already full of punctuation characters, and
    especially the '*' is existing in many contexts. Pascal, OTOH, is
    very text-biased; so its two comment variants don't annoy [me] too
    much. (The "open end" comment property is not dominating here.)


    Total_memory := 0;
    REPEAT
    Ss_status := $GETJPI( PIDADR := Wild_pid, EFN := 4, ITMLST := Jpi_list );
    IF ODD( Ss_status ) AND (Terminal_len <> 0) THEN
    BEGIN
    $WAITFR( 4 ); { Wait for asynch stuff to return } >>

    What's that '$' preceding the function names? (I don't recall that
    from the Pascal standard or from the versions I programmed with.)

    Janis


    "$" is a legal character in the set that can be used for Pascal identifiers (and, indeed, in C, specifically to support Digital dialects).

    In this particular case, the usage mirrors the MACRO-32 system call identifiers. $GETJPI calls the operating system Get Job Information
    system call which takes an item list and returns per-item data (e.g.
    process identifier, user id, terminal association, etc) to the caller.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Michael S on Sun Mar 2 13:17:12 2025
    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.

    so 80 columns was often a hard limit.

    The reasoning here is backwards. The choice of 80 columns wasn't
    made to accommodate a given aspect ratio; rather, the choice of
    screen width was made to accommodate 80 columns. Furthermore the
    choice of 80 columns was not plucked out of thin air, or made to
    fit some accidental hardware constraint; rather, the choice of 80
    columns was made to provide a suitable width for a single line, and
    hardware was designed around that.

    Probably the choice of having only 24 lines was made for some kind
    of balance and for cost reasons. But the choice of 80 columns was
    made long before choices were made for computer terminals.

    Now you have larger landscape screens, with windows that can be
    stretched as wide as you like.

    A common aspect ratio these days is 16:9 (ie, HD). But that
    choice was made to be able to show movies, not to allow absurdly
    long lines of text, which is an incidental consequence.

    For many years I use 1200x1920 (yes, portait) as my main monitor
    at work.
    Turning Full HD 90 degrees does not work as well - 1080 is too
    narrow. In this case 11% difference matters.

    My sense is that an aspect ratio of 7:5 or 3:2 (in both cases
    height:width) is about right for one page. We might want a small
    strip of screen real estate for a header, so going from 1.5 to
    1.6 seems workable (note incidentally that 1920:1200 is a ratio
    of 1.6). But HD is 1.78 to 1; that shape is just awkward for
    the display of text.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Sun Mar 2 22:07:57 2025
    On Sun, 2 Mar 2025 17:50:07 +0100, Janis Papanagnou wrote:

    (I didn't know that DEC supported a Pascal dialect.)

    It was a pretty remarkable one (at least with version 2 onwards of the compiler; the earlier version 1 was a pretty boring vanilla Pascal). It
    had various extensions for things like controlling the layout of fields
    within a record (“struct” to those who only know C), specifying global/ external symbols independently of program-internal names for things, even controlling procedure-calling and argument-passing conventions.

    In short, it was ideally suited to writing systems-oriented software on
    VMS.

    Today’s GCC has a similarly rich repertoire of attribute controls, but I don’t know of anything in-between the two that did.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Sun Mar 2 22:13:21 2025
    On Sun, 2 Mar 2025 11:31:48 +0000, bart wrote:

    Does it have optional arguments with default values? IMO keyword
    arguments are much less useful without that feature/

    The two do seem to go together. ;)

    Python has long had the feature of, not only *allowing* arguments to be specified by keyword, but *requiring* them to be passed that way, for all arguments after a specified point in the argument list.

    Newer versions even go a step further, some might say in the backwards direction, by *requiring* arguments prior to a specified point to be
    passed by position only, not keyword.

    Of course, all this ties in to the great flexibility you have with dealing
    in argument lists in Python, allowing not just for the caller to pass
    arbitrary numbers of arguments, but also use arbitrary names for them.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Mon Mar 3 02:17:15 2025
    On Sun, 2 Mar 2025 09:29:37 +0000, Richard Heathfield wrote:

    ... change does not necessarily imply progress.

    Tell that to those of us who actually find a use for the new features.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Lawrence D'Oliveiro on Mon Mar 3 02:46:01 2025
    On 03/03/2025 02:17, Lawrence D'Oliveiro wrote:
    On Sun, 2 Mar 2025 09:29:37 +0000, Richard Heathfield wrote:

    ... change does not necessarily imply progress.

    Tell that to those of us who actually find a use for the new features.

    Why?

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Richard Heathfield on Mon Mar 3 03:28:01 2025
    On 2025-03-03, Richard Heathfield <rjh@cpax.org.uk> wrote:
    On 03/03/2025 02:17, Lawrence D'Oliveiro wrote:
    On Sun, 2 Mar 2025 09:29:37 +0000, Richard Heathfield wrote:

    ... change does not necessarily imply progress.

    Tell that to those of us who actually find a use for the new features.

    Why?

    Someone claiming to be Lawrence D'Oliveiro of New Zealand has a
    LinkedIn profile which reveals he was employed only in the years 1986 to
    1997, in a "user support" role, at a university that somehow bestowed
    upon him a master's degree in CS in 1984.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Tim Rentsch on Mon Mar 3 14:13:05 2025
    On Sun, 02 Mar 2025 13:17:12 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.


    Are you sure that you measured viewing area?
    The references that I find on the net suggest 4:3 ratio for viewing
    area, which makes sense, considering 4:3 ratio of pixels in VGA's main
    graphics mode (64x480).

    240mm x 180mm for IBM 8512 color display
    212mm x 155mm for IBM 8513 color display
    283mm x 212mm for IBM 8514 color display


    so 80 columns was often a hard limit.

    The reasoning here is backwards. The choice of 80 columns wasn't
    made to accommodate a given aspect ratio; rather, the choice of
    screen width was made to accommodate 80 columns. Furthermore the
    choice of 80 columns was not plucked out of thin air, or made to
    fit some accidental hardware constraint; rather, the choice of 80
    columns was made to provide a suitable width for a single line, and
    hardware was designed around that.

    Probably the choice of having only 24 lines was made for some kind
    of balance and for cost reasons. But the choice of 80 columns was
    made long before choices were made for computer terminals.

    Now you have larger landscape screens, with windows that can be
    stretched as wide as you like.

    A common aspect ratio these days is 16:9 (ie, HD). But that
    choice was made to be able to show movies, not to allow absurdly
    long lines of text, which is an incidental consequence.

    For many years I use 1200x1920 (yes, portait) as my main monitor
    at work.
    Turning Full HD 90 degrees does not work as well - 1080 is too
    narrow. In this case 11% difference matters.

    My sense is that an aspect ratio of 7:5 or 3:2 (in both cases
    height:width) is about right for one page. We might want a small
    strip of screen real estate for a header, so going from 1.5 to
    1.6 seems workable (note incidentally that 1920:1200 is a ratio
    of 1.6). But HD is 1.78 to 1; that shape is just awkward for
    the display of text.


    In case of FHD turned 90 Degrees I am less concerned about ratio.
    I just find 1080 pixel width insufficient.
    If somebody gives me 1200x2048 (W:H) display I will use it just fine
    despite almost the same ratio as 1080x1920.
    The use case is several landscape windows placed one above another. Most
    of the time attention concentrated on one window, but occasionally goes
    to the others without need to resize or minimize anything. I find it
    more convenient than arranging windows side-by-side or then using
    multiple monitors.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Michael S on Mon Mar 3 12:29:22 2025
    On 03/03/2025 12:13, Michael S wrote:
    On Sun, 02 Mar 2025 13:17:12 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.


    Are you sure that you measured viewing area?
    The references that I find on the net suggest 4:3 ratio for viewing
    area, which makes sense, considering 4:3 ratio of pixels in VGA's main graphics mode (64x480).

    240mm x 180mm for IBM 8512 color display
    212mm x 155mm for IBM 8513 color display
    283mm x 212mm for IBM 8514 color display

    It depends on the aspect ratio of the pixels. But from I remember, in
    640x480 mode, they were square, so the aspect of the full-frame image,
    assuming no overscan, would be 4:3. The CRT physical aspect is harder to measure (some may be masked by the enclosure for example).

    Domestic TV sizes in that era (40 years ago) were also 4:3, in the UK at
    least. And a lot of monitors would have been about the same.

    (I was then developing graphics hardware with increasing resolution, but
    one problem was finding suitable monitors, with a finer shadow mask for
    colour, that could accommodate higher line and frame rates.

    Wide-screen didn't start become popular until much later. I do remember
    massive monitors like ones with a 5:4 display, or 1280x1024, that I had
    to lug to trade shows.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Richard Harnden on Mon Mar 3 13:57:40 2025
    On 03/03/2025 13:33, Richard Harnden wrote:
    On 03/03/2025 12:29, bart wrote:
    On 03/03/2025 12:13, Michael S wrote:
    On Sun, 02 Mar 2025 13:17:12 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.


    Are you sure that you measured viewing area?
    The references that I find on the net suggest 4:3 ratio for viewing
    area, which makes sense, considering 4:3 ratio of pixels in VGA's main
    graphics mode (64x480).

    240mm x 180mm for IBM 8512 color display
    212mm x 155mm for IBM 8513 color display
    283mm x 212mm for IBM 8514 color display

    It depends on the aspect ratio of the pixels. But from I remember, in
    640x480 mode, they were square, so the aspect of the full-frame image,
    assuming no overscan, would be 4:3. The CRT physical aspect is harder
    to measure (some may be masked by the enclosure for example).

    Domestic TV sizes in that era (40 years ago) were also 4:3, in the UK
    at least. And a lot of monitors would have been about the same.

    For home micros; Spectrums, BBCs, C64s etc, the TV was the monitor.

    I'm saying that even monitors designed for computer use (so with RGB
    inputs, finer shadow masks and higher line rates, including those for
    mono) were around that same aspect: 4:3 or squarer, rather than wider.

    Wider ones may well have existed, but in the period I'm talking about,
    from 1980 to sometime in the 90s, they were uncommon.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to bart on Mon Mar 3 13:33:27 2025
    On 03/03/2025 12:29, bart wrote:
    On 03/03/2025 12:13, Michael S wrote:
    On Sun, 02 Mar 2025 13:17:12 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.


    Are you sure that you measured viewing area?
    The references that I find on the net suggest 4:3 ratio for viewing
    area, which makes sense, considering 4:3 ratio of pixels in VGA's main
    graphics mode (64x480).

    240mm x 180mm for IBM 8512 color display
    212mm x 155mm for IBM 8513 color display
    283mm x 212mm for IBM 8514 color display

    It depends on the aspect ratio of the pixels. But from I remember, in
    640x480 mode, they were square, so the aspect of the full-frame image, assuming no overscan, would be 4:3. The CRT physical aspect is harder to measure (some may be masked by the enclosure for example).

    Domestic TV sizes in that era (40 years ago) were also 4:3, in the UK at least. And a lot of monitors would have been about the same.

    For home micros; Spectrums, BBCs, C64s etc, the TV was the monitor.


    (I was then developing graphics hardware with increasing resolution, but
    one problem was finding suitable monitors, with a finer shadow mask for colour, that could accommodate higher line and frame rates.

    Wide-screen didn't start become popular until much later. I do remember massive monitors like ones with a 5:4 display, or 1280x1024, that I had
    to lug to trade shows.)




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Tim Rentsch on Mon Mar 3 15:25:00 2025
    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:
    [...]
    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.

    so 80 columns was often a hard limit.

    The reasoning here is backwards. The choice of 80 columns wasn't
    made to accommodate a given aspect ratio; rather, the choice of
    screen width was made to accommodate 80 columns. Furthermore the
    choice of 80 columns was not plucked out of thin air, or made to
    fit some accidental hardware constraint; rather, the choice of 80
    columns was made to provide a suitable width for a single line, and
    hardware was designed around that.

    Specifically around the number of columns on a punched card, which
    had been used for programming for years before video terminals
    were common. In 1982, I visited a Sperry-Univac office in Clear
    Lake, Ia and they were still mostly programming with cards - they
    had a couple of video terminals on carts that were shared, but
    they had far more than two programmers competing for them.

    When I started at Burroughs in '83, each programmer had a
    TD-830 (24x80), having recently eliminated the limited number
    of cart-based terminals. One of the older programmers had
    complained that the terminals weren't used all the time, so
    it was a waste of money - until someone pointed out to him
    that his car was sitting in the parking lot most of the day.

    Note also that many early terminals supported only 12 lines due
    to the high cost of terminal RAM.

    My sense is that an aspect ratio of 7:5 or 3:2 (in both cases
    height:width) is about right for one page. We might want a small
    strip of screen real estate for a header, so going from 1.5 to
    1.6 seems workable (note incidentally that 1920:1200 is a ratio
    of 1.6). But HD is 1.78 to 1; that shape is just awkward for
    the display of text.

    Personally, I generally use vim with both horizontal and
    vertical splits to edit multiple source files and headers
    in a single window (using tabs as well, since the project
    has several hundred source files). Each split is usually
    about 30x90.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Mon Mar 3 10:34:45 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

    My sense is that an aspect ratio of 7:5 or 3:2 (in both cases
    height:width) is about right for one page. We might want a small
    strip of screen real estate for a header, so going from 1.5 to
    1.6 seems workable (note incidentally that 1920:1200 is a ratio
    of 1.6). But HD is 1.78 to 1; that shape is just awkward for
    the display of text.

    Personally, I generally use vim with both horizontal and
    vertical splits to edit multiple source files and headers
    in a single window (using tabs as well, since the project
    has several hundred source files). Each split is usually
    about 30x90.

    Nothing wrong with using HD aspect ratio for display of
    multiple pages. My comment above is about an HD aspect
    ratio for display of a single page.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Michael S on Mon Mar 3 10:49:59 2025
    Michael S <already5chosen@yahoo.com> writes:

    On Sun, 02 Mar 2025 13:17:12 -0800
    Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:

    Michael S <already5chosen@yahoo.com> writes:

    On Fri, 28 Feb 2025 00:29:29 +0000
    Richard Harnden <richard.nospam@gmail.invalid> wrote:

    [...]

    Computer terminals, back in the day, were basically square,

    My impression is that even in early days 5:4 was more common than
    square.

    Measuring an old VGA monitor, which is pretty close to an old
    computer terminal, shows an aspect ratio of 3:2 (width:height).
    Certainly not square.

    Are you sure that you measured viewing area?
    The references that I find on the net suggest 4:3 ratio for viewing
    area, which makes sense, considering 4:3 ratio of pixels in VGA's main graphics mode (64x480).

    240mm x 180mm for IBM 8512 color display
    212mm x 155mm for IBM 8513 color display
    283mm x 212mm for IBM 8514 color display

    I turned on the monitor, got it to display a full screen of
    characters, and put a tape measure next to the screen, measuring
    the distances (one horizontal, one vertical) between outside
    edges of the character array. It's possible my measurements were
    a little bit off, but not so much I think as the difference
    between 5:4 and 3:2.

    For many years I use 1200x1920 (yes, portait) as my main monitor
    at work.
    Turning Full HD 90 degrees does not work as well - 1080 is too
    narrow. In this case 11% difference matters.

    My sense is that an aspect ratio of 7:5 or 3:2 (in both cases
    height:width) is about right for one page. We might want a small
    strip of screen real estate for a header, so going from 1.5 to
    1.6 seems workable (note incidentally that 1920:1200 is a ratio
    of 1.6). But HD is 1.78 to 1; that shape is just awkward for
    the display of text.

    In case of FHD turned 90 Degrees I am less concerned about ratio.
    I just find 1080 pixel width insufficient.
    If somebody gives me 1200x2048 (W:H) display I will use it just fine
    despite almost the same ratio as 1080x1920.
    The use case is several landscape windows placed one above another. Most
    of the time attention concentrated on one window, but occasionally goes
    to the others without need to resize or minimize anything. I find it
    more convenient than arranging windows side-by-side or then using
    multiple monitors.

    Interesting. I am curious to see you in your work environment,
    not that I think that will ever happen.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to bart on Mon Mar 3 17:03:40 2025
    bart <bc@freeuk.com> writes:

    On 02/03/2025 13:52, Tim Rentsch wrote:

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 27.02.2025 10:15, Lawrence D'Oliveiro wrote:

    On Thu, 27 Feb 2025 09:38:40 +0100, Janis Papanagnou wrote:

    Too deep indenting I consider to be a possible bad structuring
    effect ...

    Would you consider half a dozen indentation levels to be too many? I
    frequently go that deep.

    To be honest, I've never counted them. So why should I suggest someone
    else what's a "good" value. Programmers certainly should have got (or
    develop) a feeling about what's acceptable and what's too much in their
    own playground (or in project contexts where many people cooperate).

    But since you were asking I got curious; I pick one recent "C" source
    from one of my toy projects and get this distribution of the amount of
    indents

    80 - // empty lines
    169 0
    254 1
    172 2
    122 3
    46 4
    34 5
    7 6
    3 7

    This measurement is an interesting idea.

    Gathering some statistics from what I expect is typical source for
    my own code, and ignoring: blank lines; lines that are flush left;
    and "non-code" lines; I get

    level percent percentile
    ===== ======= ==========
    1 69.6 69.6
    2 27.0 96.5
    3 2.2 98.7
    4 0.9 99.6
    5 0.4 100.0

    giving an average indentation of 1.36 levels. The numbers shown are
    calculated by considering the amount of leading white space in each line,
    and rounding up to an integral multiple of one indent level (which
    is four columns).

    I tried it on a non-C project and the results were:

    Level Count Percentage

    1 11843 52%
    2 6659 29%
    3 3016 13%
    4 1016 4%
    5 366 2%
    6 79 0%
    7 15 0%

    Total 22994 100%

    Total project size was 29K lines. Comments are ignored. Level 0 lines
    are ignored.

    Giving results in the same form as my table

    level percent percentile
    ===== ======= ==========
    1 51.5 51.5
    2 29.0 80.5
    3 13.1 93.6
    4 4.4 98.0
    5 1.6 99.6
    6 0.3 99.9
    7 0.1 100.0

    giving an average indentation of 1.77 levels. Thank you for
    posting your results.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Keith Thompson on Tue Mar 4 03:17:28 2025
    On Mon, 03 Mar 2025 15:23:52 -0800, Keith Thompson wrote:

    IBM developed 80-column cards, with the same overall size, in the late
    1920s. Apparently 80 just happened to be the number of rectangular
    holes that could reasonably be accommodated (and it's a nice round
    number). And 80-column video terminals were baed on card sizes (though
    I think some earlier terminals had 40 columns).

    Where did 132-column printers come from?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Tue Mar 4 03:16:24 2025
    On Mon, 3 Mar 2025 12:29:22 +0000, bart wrote:

    It depends on the aspect ratio of the pixels. But from I remember, in
    640x480 mode, they were square ...

    This is just shorthand for saying the pixel density is uniform, i.e. the
    same horizontally and vertically.

    Remember, pixels have no shape. In ideal sampling, they are dimensionless points.

    Those “pixels” you see on your screen are shaped by what’s called the “reconstruction function”. This takes the set of sample values to generate an analog image which is some approximation of the original input image
    (if the input came from an image of the real world).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Tue Mar 4 06:12:54 2025
    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:
    On Mon, 03 Mar 2025 15:23:52 -0800, Keith Thompson wrote:

    IBM developed 80-column cards, with the same overall size, in the late
    1920s. Apparently 80 just happened to be the number of rectangular
    holes that could reasonably be accommodated (and it's a nice round
    number). And 80-column video terminals were baed on card sizes (though
    I think some earlier terminals had 40 columns).

    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    Historically there were various types of printers developed that were supporting various number of characters per line. Some printer types,
    e.g. from IBM, especially the chain-printers that were common in IT,
    supported 132 characters. - My guess would be that because of IBM's
    dominance in IT back these days made that a not uncommon choice. Once
    any (company-)standard is in the world other vendors orient on that.
    (There have also been other chain-printers with 100 characters/line.
    And other printer types with yet more variance in characters/line.)

    Such chain-printer standard might later have influenced also terminals
    like the VT100 with its 80/132 display modes. (Here we have to also
    consider the display character masks; it must somehow evenly fit into
    the sizes and be still readable.)

    Other factors in printing technology can probably be derived from
    common paper sizes and the colonial, inch-based units; standards like
    printers printing 10 characters per inch, or fonts measured in dots per
    inch. (I'd think quite some quasi-arbitrary numbers can be derived.)

    WRT chain-printers; the paper width is quite unwieldy for non-IT use.
    (I suppose they wanted to not restrict possible data output too much.)
    Linearly calculating down the listing-paper size from its format to
    Letter format (or DIN A4) will result in values more common for books.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Tue Mar 4 05:39:25 2025
    On Tue, 4 Mar 2025 06:12:54 +0100, Janis Papanagnou wrote:

    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:

    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    The point being, the idea that 80 columns is a good line length for
    programming is, shall we say, based on doubtful evidence.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Tue Mar 4 17:56:02 2025
    Ar Rakin:

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style
    2. Linux Style

    I don't like them much. Below is a piece of my code
    (previosly shown in this group). It uses tabs for
    indentation and spaces for alignment.

    -- sort.c --
    #include <stdio.h>
    #include <limits.h>
    #include "sort.h"

    /* Partition an array [l..r] around a "pivot" member so that */
    /* the elements of the left sub-array do not exceed, and the ones */
    /* of the right sub-array are not less than, the pivot. */
    static int /* returns the right boundary of the left sub-array */
    partition
    ( void * data, /* pointer to the full array */
    int l, /* left boundary of the sub-array */
    int r, /* right boundary of the sub-array, l < r */
    comp_f comp,
    swap_f swap,
    void * extra
    )
    { int p; /* index of the pivot, element */
    p = ( l + r ) / 2; /* Chose the middle element as pivot */

    while( 1 )
    { /* advance cursors until they stop at a pair of elements */
    /* that should be swapped or meet or go past each other. */
    /* The pivot element serves as a sentinel. */
    while( comp( data, l, p, extra ) < 0 ) l += 1;
    while( comp( data, r, p, extra ) > 0 ) r -= 1;
    if( l >= r ) break;

    swap( data, l, r ); /* Swap the pair found */
    if( l == p ) p = r; /* Update pivot location if it */
    else if( r == p ) p = l; /* was changed during the swap */

    /* Advance the cursors. If they are adjecent they will cross: */
    l += 1; r -= 1;
    }
    return r;
    }

    void sort
    ( void * data,
    int len,
    comp_f comp,
    swap_f swap,
    void * extra
    )
    { /* In this algorithm, minimun sufficient stack size is Log(len) */
    int sl[sizeof(int) * CHAR_BIT]; /* left sub-array boundaries on the stack */
    int sr[sizeof(int) * CHAR_BIT]; /* right sub-array boundaries nn the stack */

    int d; /* stack depth */
    int l, r; /* left and right boundaries of a sub-array */
    int lpos, rpos; /* positions of the left and right new sub-arrays on the stack */
    int newr; /* the right boundary of the new left sub-array */

    d = 1; /* Put the initial sub-array onto the stack */
    sl[0] = 0; sr[0] = len - 1;
    while( d > 0 )
    { d -= 1; /* Take an element from the stack */
    l = sl[d]; r = sr[d];
    if( l >= r ) continue; /* Skip a subarray shorter than two */

    newr = partition( data, l , r, comp, swap, extra );

    /* process the shorter sub-array first to ease the stack: */
    lpos = d; rpos = d;
    if( newr - l > r - newr - 1 ) rpos += 1;
    else lpos += 1;

    /* Put partiioned sub-arrays onto the stack: */
    sl[lpos] = l; sr[lpos] = newr;
    sl[rpos] = newr + 1; sr[rpos] = r;
    d += 2;
    }
    }
    -- sort.h --
    /* ----------------------- A generic sorting routine ------------------------ */
    /* Comparison function:
    > 0 <=> data[i] > data[j]
    < 0 <=> data[i] < data[j]
    == 0 <=> data[i] = data[j] */
    typedef int (*comp_f)( const void * data, int i, int j, void * extra );

    /* Exchange ith and jth elements: */
    typedef void (*swap_f)( void * data, int i, int j );

    void sort
    ( void * data, /* pointer to data to sort */
    int len, /* length of data to sort */
    comp_f comp, /* comparison function */
    swap_f swap, /* swap function */
    void * extra /* user-supplied parameter to comp */
    );
    -- test.c --
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include "sort.h"

    static void print( int * a, int n )
    { int i;
    for( i = 0; i < n; i++ )
    printf("%i ", a[i] );
    printf("\n");
    }

    static int intcomp( int a, int b )
    { if( a > b ) return 1;
    if( a < b ) return -1;
    return 0;
    }

    static int comp( const void * data, int i, int j, void * extra )
    { return intcomp( ( (int*)data )[i], ( (int*)data )[j] ); }

    /* comparison for qsort: */
    static int qscomp(const void * a, const void * b)
    { return intcomp( *(int*)a, *(int*)b ); }

    static void swap( void * data, int i, int j )
    { int buf;
    buf = ( (int*)data )[i];
    ( (int*)data )[i] = ( (int*)data )[j];
    ( (int*)data )[j] = buf;
    }

    #define TESTLEN 500
    /* performance test with a random array: */
    static void test()
    { int a[TESTLEN], c[TESTLEN];
    int i, j;
    clock_t start, total;

    total = 0;
    for( i = 0; i < 1000; i++ )
    { for( j = 0; j < TESTLEN; j++ )
    { a[j] = rand() % 5;
    c[j] = a[j];
    }
    start = clock();
    /*qsort( a, testlen, sizeof(int), &qscomp );*/
    sort( a, TESTLEN, &comp, &swap, NULL );
    total += clock() - start;
    for( j = 0; j < TESTLEN-1; j++ )
    { if( a[j] > a[j+1] )
    { print( c, TESTLEN );
    print( a, TESTLEN );
    return;
    }
    }
    }
    printf("Time: %f\n", (float)total / CLOCKS_PER_SEC );
    }

    /* test with a small hard-coded array: */
    #define TMLEN 3
    static void testman( void )
    { int ta[TMLEN] = {3,2,1};
    print( ta, TMLEN );
    sort ( ta, TMLEN, &comp, &swap, NULL );
    print( ta, TMLEN );
    }

    int main( int argc, char** argv )
    { /*testman();
    return 0;*/

    test();
    return 0;
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Anton Shepelev on Tue Mar 4 15:18:32 2025
    On 04/03/2025 14:56, Anton Shepelev wrote:
    Ar Rakin:

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style
    2. Linux Style

    I don't like them much. Below is a piece of my code

    I don't like most of the choices you've made :-) *but* I can see
    perfectly good reasons for making those choices (if that's any
    consolation).

    Just about the only choice of yours that I /do/ like is your
    brace placement:

    {
    {
    {
    }
    }
    }

    which like because it makes the code's structure stand out so
    clearly. I know a lot of people criticise this style for being
    wasteful of vertical space, but I've never seen that as a
    problem. My screen can hold more than enough code to occupy me,
    and my annual vertical space bill is very reasonable.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Keith Thompson on Tue Mar 4 15:55:18 2025
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Tue, 4 Mar 2025 06:12:54 +0100, Janis Papanagnou wrote:
    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:
    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    The point being, the idea that 80 columns is a good line length for
    programming is, shall we say, based on doubtful evidence.

    Why are you writing that in (indirect) response to a post in which I
    already acknowledged that?

    Because he's a troll?


    If your question about 132-column printers was intended to make a point,
    why not just make that point directly?

    Because he's a troll?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Richard Heathfield on Tue Mar 4 16:01:54 2025
    On 04/03/2025 15:18, Richard Heathfield wrote:
    On 04/03/2025 14:56, Anton Shepelev wrote:
    Ar Rakin:

    I've been writing C code for a long time, in different styles, but
    always wanted to know which code style most people prefer. This is all
    about that question. Which one of the following do you prefer the most?

    1. GNU Style
    2. Linux Style

    I don't like them much. Below is a piece of my code

    I don't like most of the choices you've made :-) *but* I can see
    perfectly good reasons for making those choices (if that's any
    consolation).

    Just about the only choice of yours that I /do/ like is your brace
    placement:

    {
      {
        {
        }
      }
    }

    which  like because it makes the code's structure stand out so clearly.
    I know a lot of people criticise this style for being wasteful of
    vertical space, but I've never seen that as a problem. My screen can
    hold more than enough code to occupy me, and my annual vertical space
    bill is very reasonable.


    I assume that style would be used like this:

    if (cond)
    {
    stmt1;
    }
    else
    {
    stmt2;
    }

    So 50% of lines are solely for braces, with braces not having their own
    indent level. However if I now look at AS's post, that isn't it: opening
    braces don't have their own dedicated line, they are shared with the
    first line of the block:

    if (cond)
    { stmt1;
    }
    else
    { stmt2;
    }

    This cuts down the line count, but now the first line is a special case:
    it's got that extra clutter at the start, makes it harder to swap with
    other lines, to temporarily comment out, to delete, or to add extra,
    perhaps debugging, lines at the start of the block.

    The style I use for generated code is like this:

    if (cond) {
    stmt1;
    }
    else {
    stmt2;
    }

    The same amount of vertical space, but none of those problems. So this
    is superior IMV.

    (That is, when you have to use braces; generally I don't like that style
    of syntax *because* there are so many placement styles: there are
    multiple ways of writing the three tokens of '} else {'; not so many if
    it's just the single token 'else'.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to bart on Tue Mar 4 18:14:43 2025
    On 2025-03-04, bart <bc@freeuk.com> wrote:
    The style I use for generated code is like this:

    if (cond) {
    stmt1;
    }
    else {
    stmt2;
    }

    I've been known to do this:

    if (case_ineligible_for_switch) {
    // ...
    } else switch (state_variable) {
    // ...
    }

    or

    if (case_not_requiring_loop) {
    // ...
    } else for (;;) {
    // ...
    }

    and I might even have historically perpetrated something like:

    if (case_not_requiring_loop) {
    // ...
    } else if (case_requiring_loop) for (;;) {
    // ...
    } else {
    // ...
    }

    :)

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Tue Mar 4 20:49:23 2025
    On Tue, 4 Mar 2025 05:39:25 -0000 (UTC), I wrote:

    On Tue, 4 Mar 2025 06:12:54 +0100, Janis Papanagnou wrote:

    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:

    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    The point being, the idea that 80 columns is a good line length for programming is, shall we say, based on doubtful evidence.

    And also, there was one computer company, might have been ICL, that used 90-column punch cards.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Kaz Kylheku on Tue Mar 4 21:49:46 2025
    On 04/03/2025 18:14, Kaz Kylheku wrote:
    On 2025-03-04, bart <bc@freeuk.com> wrote:
    The style I use for generated code is like this:

    if (cond) {
    stmt1;
    }
    else {
    stmt2;
    }

    I've been known to do this:

    if (case_ineligible_for_switch) {
    // ...
    } else switch (state_variable) {
    // ...
    }

    or

    if (case_not_requiring_loop) {
    // ...
    } else for (;;) {
    // ...
    }

    and I might even have historically perpetrated something like:

    if (case_not_requiring_loop) {
    // ...
    } else if (case_requiring_loop) for (;;) {
    // ...
    } else {
    // ...
    }

    :)


    I like the brace on its own line. It visually separates the condidition
    from the statement.

    How do people format long and complex conditions, given that you're
    trying not to a much over 80 columns?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Richard Harnden on Tue Mar 4 22:17:34 2025
    On 04/03/2025 21:49, Richard Harnden wrote:

    <snip>


    I like the brace on its own line.  It visually separates the
    condidition from the statement.

    Agreed.


    How do people format long and complex conditions, given that
    you're trying not to a much over 80 columns?

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Lawrence D'Oliveiro on Tue Mar 4 22:15:22 2025
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Tue, 4 Mar 2025 05:39:25 -0000 (UTC), I wrote:

    On Tue, 4 Mar 2025 06:12:54 +0100, Janis Papanagnou wrote:

    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:

    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    The point being, the idea that 80 columns is a good line length for
    programming is, shall we say, based on doubtful evidence.

    And also, there was one computer company, might have been ICL, that used >90-column punch cards.

    That would be Rand.

    A more (but not fully) complete answer would include 96-columns from the company was once known as the Computing Scale Company.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Richard Heathfield on Tue Mar 4 22:26:12 2025
    On 2025-03-04, Richard Heathfield <rjh@cpax.org.uk> wrote:
    On 04/03/2025 21:49, Richard Harnden wrote:

    <snip>


    I like the brace on its own line.  It visually separates the
    condidition from the statement.

    Agreed.


    How do people format long and complex conditions, given that
    you're trying not to a much over 80 columns?

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    (when (or (and (/= a b)
    (/= c d)
    (/= e f))
    (and (= g (* (h)
    (i)))
    (= j k)))
    (foo))


    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Kaz Kylheku on Tue Mar 4 22:40:03 2025
    On 04/03/2025 22:26, Kaz Kylheku wrote:
    On 2025-03-04, Richard Heathfield <rjh@cpax.org.uk> wrote:
    On 04/03/2025 21:49, Richard Harnden wrote:

    <snip>


    I like the brace on its own line.  It visually separates the
    condidition from the statement.

    Agreed.


    How do people format long and complex conditions, given that
    you're trying not to a much over 80 columns?

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    (when (or (and (/= a b)
    (/= c d)
    (/= e f))
    (and (= g (* (h)
    (i)))
    (= j k)))
    (foo))

    @ (or)
    @ (output)
    Take one down and pass it around...

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Harnden on Tue Mar 4 23:36:13 2025
    On Tue, 4 Mar 2025 21:49:46 +0000, Richard Harnden wrote:

    I like the brace on its own line. It visually separates the condidition
    from the statement.

    If the structure closer belongs on its own line, then so should the
    structure opener. That way they can be kept at the same indentation level,
    to further tie them together visually.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Tue Mar 4 23:45:09 2025
    On Tue, 4 Mar 2025 22:17:34 +0000, Richard Heathfield wrote:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    if
    (
    a != b && c != d && e != f
    ||
    g == h() * i() && j == k
    )
    {
    foo();
    } /*if*/

    (with typos corrected and parentheses clutter removed)

    Or better, with alternative symbols from iso646.h:

    if
    (
    a != b and c != d and e != f
    or
    g == h() * i() and j == k
    )
    {
    foo();
    } /*if*/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Wed Mar 5 05:09:08 2025
    On 04.03.2025 21:49, Lawrence D'Oliveiro wrote:
    On Tue, 4 Mar 2025 05:39:25 -0000 (UTC), I wrote:
    On Tue, 4 Mar 2025 06:12:54 +0100, Janis Papanagnou wrote:
    On 04.03.2025 04:17, Lawrence D'Oliveiro wrote:

    Where did 132-column printers come from?

    From IBM ? - Or S&H ?

    The point being, the idea that 80 columns is a good line length for
    programming is, shall we say, based on doubtful evidence.

    And also, there was one computer company, might have been ICL, that used 90-column punch cards.

    Not only one; there were various sizes around; I find for example
    80 - IBM, Bull
    45, 90 - Rand
    21, 40, 65, 80, 130, 160 - ICT
    So what?

    (For "programming" sensible ranges depend on many factors; first of
    all on the programming language, and then on the structuring of your
    code, used identifier lengths, expression complexity, and whatnot.
    Trying to compensate suboptimal programming choices by extending
    the used line length doesn't solve the basic readability issues but
    often just introduce other upthread already mentioned issues. YMMV.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Wed Mar 5 05:21:59 2025
    On 04.03.2025 17:01, bart wrote:
    [ big snip of possible and personal style preferences ]

    (That is, when you have to use braces; generally I don't like that style
    of syntax *because* there are so many placement styles: there are
    multiple ways of writing the three tokens of '} else {'; not so many if
    it's just the single token 'else'.)

    Right, not so many. But still there are options.

    if (c)
    this();
    else
    that();

    if (c) this();
    else that();

    if (c) this();
    else that();

    if (c) this(); else that();

    And then, what do you do if there's another statement to be added in
    either of the branches? You'll then have to bite the bullet use braces
    anyway! And then, again yet more style choices; only put braces around
    the new compound statement or using a "complete" (bracing everything)
    style?

    My post is not suggesting any specific [personal/preferred] style. Just pointing out that because of the unavoidable multitude there should be
    some style guideline.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Wed Mar 5 04:24:23 2025
    On Wed, 5 Mar 2025 05:09:08 +0100, Janis Papanagnou wrote:

    Trying to compensate suboptimal programming choices by extending the
    used line length ...

    The term “strawman” comes to mind ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Wed Mar 5 05:46:12 2025
    On 04.03.2025 23:17, Richard Heathfield wrote:
    On 04/03/2025 21:49, Richard Harnden wrote:

    How do people format long and complex conditions, given that you're
    trying not to a much over 80 columns?

    I had a look into that "C" project where I posted some excerpts but unfortunately it hasn't code that's artificially split; I seem to
    avoid overly complex expressions in the first place.

    BTW, one way to avoid complex expressions is to use interim variables
    (if possible for semantical parts). (This had previously already been
    suggested by someone else here some time ago).


    I like to break after a binary operator so that it is syntactically
    obvious that the line must continue:

    In principle I do the same. - But in cases like this:


    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    I prefer a logical bundling (and also try not to put '||' and '&&' in
    the same category); something like

    if ((a != b && c != d && e != f) ||
    (g = h() * i() && (j = k))) // assuming assignments here
    {
    foo();
    }

    and, depending on the expression complexity, occasionally adding some
    more spaces, like

    if ((a != b && c != d && e != f) ||

    to easier identify the components (relational first, logical later).

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From vallor@21:1/5 to janis_papanagnou+ng@hotmail.com on Wed Mar 5 07:02:46 2025
    On Wed, 5 Mar 2025 05:46:12 +0100, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote in <vq8kul$29gdt$1@dont-email.me>:

    On 04.03.2025 23:17, Richard Heathfield wrote:
    On 04/03/2025 21:49, Richard Harnden wrote:

    How do people format long and complex conditions, given that you're
    trying not to a much over 80 columns?

    I had a look into that "C" project where I posted some excerpts but unfortunately it hasn't code that's artificially split; I seem to avoid overly complex expressions in the first place.

    BTW, one way to avoid complex expressions is to use interim variables
    (if possible for semantical parts). (This had previously already been suggested by someone else here some time ago).


    I like to break after a binary operator so that it is syntactically
    obvious that the line must continue:

    In principle I do the same. - But in cases like this:


    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    I prefer a logical bundling (and also try not to put '||' and '&&' in
    the same category); something like

    if ((a != b && c != d && e != f) ||
    (g = h() * i() && (j = k))) // assuming assignments here
    {
    foo();
    }

    It may forever label me as a pariah, but if I were writing
    this for myself, I'd probably put it:

    if (
    (a != b && c != d && e != f)
    ||
    (g = h() * i() && (j = k)
    )
    {
    foo();
    }

    However, my C foo is not what it used to be. (Indeed, part of me
    wants to indent the braces around "foo()", but that would make it
    look ugly(er).)


    and, depending on the expression complexity, occasionally adding some
    more spaces, like

    if ((a != b && c != d && e != f) ||

    to easier identify the components (relational first, logical later).

    Janis

    --
    -Scott

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Janis Papanagnou on Wed Mar 5 08:39:55 2025
    On 05/03/2025 08:35, Janis Papanagnou wrote:
    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses

    (I (bet ((you ((jutht) love) Lithp).)))

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Wed Mar 5 09:58:45 2025
    On 05.03.2025 09:39, Richard Heathfield wrote:
    On 05/03/2025 08:35, Janis Papanagnou wrote:
    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses

    (I (bet ((you ((jutht) love) Lithp).)))

    With my first glimpse of lithp code I immediately felt repelled, erm..,
    wrong word - I meant: felt deep and long lasting _respect_ for it. :-)

    But I know there are folks who really love it. - That's fine by me.

    (It's always good if you have options to choose from.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to vallor on Wed Mar 5 09:35:17 2025
    On 05.03.2025 08:02, vallor wrote:

    It may forever label me as a pariah, but if I were writing
    this for myself, I'd probably put it:

    if (
    (a != b && c != d && e != f)
    ||
    (g = h() * i() && (j = k)
    )

    Why "pariah"?
    That looks (while maybe not prevalent) quite clear and sensible.

    It hasn't prevented you from a missing parenthesis, though. ;-)

    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses, compared to (for example)

    IF a /= b AND c /= d AND e /= f
    OR
    g = h * i AND j = k
    THEN

    (Note that this code is not equivalent to the "C" code (assignment
    vs. equality test)[*]. It should just illustrate what it means if all
    those spurious parenthesis are omitted from a language. Of course
    you can also add parenthesis around the 'AND' expressions to make
    things clear. But 'if' or functions without parameters don't need
    parenthesis [in other non-"C"-like languages].)

    Janis

    [*] The sample based on Algol 68 doesn't treat an 'int' as a 'bool'.
    So functionally more equivalent something like this may be given

    IF a /= b AND c /= d AND e /= f
    OR
    (g := h * i; g /= 0) AND (j := k; j)

    assuming j, k be bools, or (j := k; j != 0) if they are ints.

    Pascal has a similar parenthesis-free syntax concerning the control
    constructs and parameterless functions, but (surprisingly) they had
    decided to have relational expressions written in parenthesis in
    such contexts: (a <> b) AND (c <> d) AND (e <> f)


    {
    foo();
    }

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Wed Mar 5 15:22:24 2025
    Richard Heathfield:

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    There is no way I like for the formatting of multiline
    conditions in if()'s. Perhaps:

    if
    ( a != b && c != d && e != f ||
    g = h() * i() && (j = k)
    )
    { foo();
    }

    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Anton Shepelev on Wed Mar 5 14:44:00 2025
    On 05/03/2025 13:22, Anton Shepelev wrote:
    Richard Heathfield:

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b &&
    c != d &&
    e != f) ||
    (g = h() * i() &&
    (j = k))
    {
    foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    There is no way I like for the formatting of multiline
    conditions in if()'s.

    Agreed. The correct (IMNO, of course) way to re-format the code above
    is to throw it out and start again. There is no way to make it clear in
    a single expression. (The appropriate way to organise the final result
    will depend on what these different identifiers actually are in real code.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to David Brown on Wed Mar 5 14:20:59 2025
    On 05/03/2025 13:44, David Brown wrote:
    On 05/03/2025 13:22, Anton Shepelev wrote:
    Richard Heathfield:

    I like to break after a binary operator so that it is
    syntactically obvious that the line must continue:

    if((a != b        &&
          c != d        &&
          e != f)       ||
         (g = h() * i() &&
         (j = k))
    {
        foo();
    }

    (You'll be glad to hear that that's not a direct quote!)

    There is no way I like for the formatting of multiline
    conditions in if()'s.

    Agreed.  The correct (IMNO, of course) way to re-format the code
    above is to throw it out and start again.  There is no way to
    make it clear in a single expression.  (The appropriate way to
    organise the final result will depend on what these different
    identifiers actually are in real code.)

    I can now reveal that in real code those identifiers don't exist,
    having been spun into existence merely to serve as an illustration.

    In practice, of course, one would have refactored the code long
    before it reached this advanced stage of nonsensicalitude.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Shepelev@21:1/5 to All on Wed Mar 5 18:30:51 2025
    Richard Heathfield:

    I can now reveal that in real code those identifiers don't
    exist, having been spun into existence merely to serve as
    an illustration.

    In practice, of course, one would have refactored the code
    long before it reached this advanced stage of
    nonsensicalitude.

    Of course, but with longer identifiers, even sensible
    conditions often jutt beyond the 80-character margin.


    --
    () ascii ribbon campaign -- against html e-mail
    /\ www.asciiribbon.org -- against proprietary attachments

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Wed Mar 5 18:09:46 2025
    On 05.03.2025 17:40, bart wrote:
    [...]
    Now some use ridiculously long identifiers. And actually, some compilers don't have a cap on the length. I once tried to compile code like this
    with gcc:

    int a, b, c;
    a = b + c;

    but using machine-generated billion-character identifiers. I think it
    worked, eventually.

    The context in the thread this came up in was whether names should have
    any limit on the length (my tools capped them at 255 characters), and
    most thought they shouldn't. But even 255 characters would be hopelessly impractical if using a text editor.

    Your choice is IMO large enough with plenty of room for pathological
    variable name lengths. The longest name constructs I encountered was
    in Java contexts; first of all long names were used, but the total
    length came from sequences of dot-separated entities. (Still within
    limits like 255.)

    Of course, if you can prevent limits in the first place that would be
    yet better. But are flexible limits necessary here in practice? (I'd
    be interested to hear whether anyone encountered such long names, or
    felt a need for that.[*])

    Reminds me the file name evolution/revolution; in earlier days (due
    to length restrictions) file names have often been abbreviated, in
    more recent days file _names_ have often become file _novels_ (even
    carrying other stuff, file meta-information, or complete stories in
    it, sort of). - Evolving from one extreme to the other...

    Janis

    [*] I could imagine some compiler internal name-mangled entities.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Anton Shepelev on Wed Mar 5 16:40:51 2025
    On 05/03/2025 15:30, Anton Shepelev wrote:
    Richard Heathfield:

    I can now reveal that in real code those identifiers don't
    exist, having been spun into existence merely to serve as
    an illustration.

    In practice, of course, one would have refactored the code
    long before it reached this advanced stage of
    nonsensicalitude.

    Of course, but with longer identifiers, even sensible
    conditions often jutt beyond the 80-character margin.

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    Now some use ridiculously long identifiers. And actually, some compilers
    don't have a cap on the length. I once tried to compile code like this
    with gcc:

    int a, b, c;
    a = b + c;

    but using machine-generated billion-character identifiers. I think it
    worked, eventually.

    The context in the thread this came up in was whether names should have
    any limit on the length (my tools capped them at 255 characters), and
    most thought they shouldn't. But even 255 characters would be hopelessly impractical if using a text editor.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Janis Papanagnou on Wed Mar 5 17:32:42 2025
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]
    Now some use ridiculously long identifiers. And actually, some compilers
    don't have a cap on the length. I once tried to compile code like this
    with gcc:

    int a, b, c;
    a = b + c;

    but using machine-generated billion-character identifiers. I think it
    worked, eventually.

    The context in the thread this came up in was whether names should have
    any limit on the length (my tools capped them at 255 characters), and
    most thought they shouldn't. But even 255 characters would be hopelessly
    impractical if using a text editor.

    Your choice is IMO large enough with plenty of room for pathological
    variable name lengths. The longest name constructs I encountered was
    in Java contexts; first of all long names were used, but the total
    length came from sequences of dot-separated entities. (Still within
    limits like 255.)

    Of course, if you can prevent limits in the first place that would be
    yet better. But are flexible limits necessary here in practice? (I'd
    be interested to hear whether anyone encountered such long names, or
    felt a need for that.[*])

    Reminds me the file name evolution/revolution; in earlier days (due
    to length restrictions) file names have often been abbreviated, in
    more recent days file _names_ have often become file _novels_ (even
    carrying other stuff, file meta-information, or complete stories in
    it, sort of). - Evolving from one extreme to the other...

    Also: Emojis. The coloured-pencil office is guilty of this.

    Seriously, short variable names for common things - i, j, k for loop
    counters; x and y for coordinates; p, q and r for maths.

    C has allowed declaration just be use for years now. There is no need
    for variable names to be anywhere near 255 characters.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Richard Harnden on Wed Mar 5 17:51:32 2025
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop >counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Scott Lurndal on Wed Mar 5 19:50:04 2025
    On 05.03.2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:

    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER

    Ah, right! I forgot about that. - But is that the answer?

    We've got such conventions from math; a, b, c, for lines,
    x, y, z, for coordinates, p, q, r, for points, i, j, k,
    for indexes, and so on. Loops often iterate over indexes.

    Janis
    --
    for (number_of_natively_born_people_in_coast_states_without_havens = 0;
    number_of_natively_born_people_in_coast_states_without_havens <=

    maximum_number_of_natively_born_people_in_coast_states_without_havens;
    number_of_natively_born_people_in_coast_states_without_havens++)

    Segmentation fault (core dumped)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Janis Papanagnou on Wed Mar 5 19:12:16 2025
    On 2025-03-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 05.03.2025 09:39, Richard Heathfield wrote:
    On 05/03/2025 08:35, Janis Papanagnou wrote:
    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses

    (I (bet ((you ((jutht) love) Lithp).)))

    With my first glimpse of lithp code I immediately felt repelled, erm..,
    wrong word - I meant: felt deep and long lasting _respect_ for it. :-)

    But I know there are folks who really love it. - That's fine by me.

    (It's always good if you have options to choose from.)

    Lisp offers ways to break long expressions in multiple ways,
    all falling under the same general algorithm that is easy supported
    in your editor.

    That's why I posted that example:

    (when (or (and (/= a b)
    (/= c d)
    (/= e f))
    (and (= g (* (h)
    (i)))
    (= j k)))
    (foo))

    You just don't have these stylistic issues about where to put
    the operator relative to the operand. Is it:

    a ||
    b

    or

    a
    || b

    or

    a
    ||
    b

    etc.

    Using a few keystrokes, I can turn it into

    (when
    (or
    (and
    (/= a b)
    (/= c d)
    (/= e f))
    (and
    (= g
    (* (h)
    (i)))
    (= j k)))
    (foo))

    Or

    (when (or (and (/= a b) (/= c d) (/= e f))
    (and (= g (* (h) (i))) (= j k)))
    (foo))

    The editor reindents everything. I mean right here. I'm in Vim typing
    a .followup file. I just went into :set lisp mode, and there it is.

    The Lisp code gives us a tree view where we can clearly see that there is a main (or ...) node which has two (and ...) children. It has the
    same shape as a tree control in a GUI:

    or +-- and +-- (/= a b)
    | |
    | +-- (/= c d)
    |
    +-- and +-- = +-- g
    |
    +-- * +-- (h)
    |
    +-- (i)


    If we draw it using logic symbols (and gates, or gates), it will look similar also, (with the signals going right to left).

    In recent years (well nearly a decade ago now), there has been a new development in Lisp editing: the "parinfer" algorithm by Shaun LeBron. Parinfer operates in two modes: you can control the indentation and it automatically supplies the parentheses, on the fly. Or you can control parentheses and it reindents as you type.

    The original home page is here, featuring animations:

    https://shaunlebron.github.io/parinfer/

    It has been implemented in many editors. I use a somewhat shabby Vim implementation of it nowadays which only works reliably in the
    indent -> parens mode.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Tobin@21:1/5 to Scott Lurndal on Wed Mar 5 19:09:30 2025
    In article <Ea0yP.6763$SVG3.6427@fx42.iad>,
    Scott Lurndal <slp53@pacbell.net> wrote:

    Seriously, short variable names for common things - i, j, k for loop >>counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER

    Why did Fortran have I-N as implicit integers? Because of common
    mathematical practice, which uses those letters as subscripts.

    Fortran's role in this convention is as an intermediary rather the as
    the origin.

    -- Richard

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Scott Lurndal on Wed Mar 5 19:18:20 2025
    On 2025-03-05, Scott Lurndal <scott@slp53.sl.home> wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop >>counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER

    I don't think it's as simple as blaming Fortran. Fortran itself
    starts the implicit integer variables at i for a reason.

    That reason is that the variable i is used as an indexing dumy
    variable in mathematics. I seem to recall that it's because it
    is the first letter of the Latin word "index".

    Using i for indexing, and then allocating nested indices using
    subsequent letters after i, is a practice that long precedes
    the existence of computers and Fortran.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Kaz Kylheku on Wed Mar 5 20:07:38 2025
    On 05/03/2025 19:18, Kaz Kylheku wrote:

    <snip>

    Using i for indexing, and then allocating nested indices using
    subsequent letters after i, is a practice that long precedes
    the existence of computers and Fortran.

    It all started with Irving Joshua Matrix, a close personal friend
    of Martin Gardner (well-known Press Officer for the University of
    Chicago). Dr Matrix, who gave his surname to the celebrated
    mathematical construct, famously bequeathed his initials to
    medical indexing. Fortran's 'implicit' keyword led to one of the
    longest and ugliest court cases in computing history, settled out
    of court in Dr Matrix's favour in 2018 for an undisclosed sum.

    Sadly, just two years ago Dr Matrix died of runaway recursion. He
    is survived by his children Ivy, James, Keith, Lisa, and Maria.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Kaz Kylheku on Wed Mar 5 21:53:58 2025
    On 05.03.2025 20:12, Kaz Kylheku wrote:
    On 2025-03-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 05.03.2025 09:39, Richard Heathfield wrote:
    On 05/03/2025 08:35, Janis Papanagnou wrote:
    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses

    (I (bet ((you ((jutht) love) Lithp).)))

    With my first glimpse of lithp code I immediately felt repelled, erm..,
    wrong word - I meant: felt deep and long lasting _respect_ for it. :-)

    But I know there are folks who really love it. - That's fine by me.

    (It's always good if you have options to choose from.)

    Lisp offers ways to break long expressions in multiple ways,
    all falling under the same general algorithm that is easy supported
    in your editor.

    That's why I posted that example:

    (when (or (and (/= a b)
    (/= c d)
    (/= e f))
    (and (= g (* (h)
    (i)))
    (= j k)))
    (foo))

    You just don't have these stylistic issues about where to put
    the operator relative to the operand. [...]

    But isn't that a property of every system specified in either
    Polish Notation (like Lisp) or Reversed Polish Notation, that
    require no parenthesis to evaluate expressions? Interestingly,
    Lisp (employing such a in principle parenthesis-free language)
    utilizes a lot parenthesis for grouping its list elements. ;-)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Richard Heathfield on Wed Mar 5 21:46:36 2025
    On 05.03.2025 21:07, Richard Heathfield wrote:

    It all started with Irving Joshua Matrix, a close personal friend of
    Martin Gardner (well-known Press Officer for the University of Chicago).
    Dr Matrix, who gave his surname to the celebrated mathematical
    construct, famously bequeathed his initials to medical indexing.
    Fortran's 'implicit' keyword led to one of the longest and ugliest court cases in computing history, settled out of court in Dr Matrix's favour
    in 2018 for an undisclosed sum.

    Is that "Dr Matrix" a joke?

    According to the Wikipedia (DE) the term stems from the Latin word
    Matrix and was coined in 1850 by James Joseph Sylvester (Cambridge)
    for the respective mathematical construct he was working with.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Wed Mar 5 22:02:57 2025
    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed 31.

    Whatever it was you meant by “80-character hardware” (see discussion elsewhere) ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bart@21:1/5 to Lawrence D'Oliveiro on Wed Mar 5 23:46:13 2025
    On 05/03/2025 22:02, Lawrence D'Oliveiro wrote:
    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed 31.

    So:

    ADD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA TO BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    GIVING CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.

    ? A tight fit for an 80-column card I think.

    I think linker symbols were more limited; on DEC typically 6 characters
    for example.

    I suspect the 30 characters were as a much of an arbitrary
    implementation limit as my 255; you wouldn't supposed to get anywhere
    near it.


    Whatever it was you meant by “80-character hardware” (see discussion elsewhere) ...

    Punched cards, teletypes and VDUs tended to use 72/80 columns. The first
    text display I owned used 64. I think home or small-business printers
    (not lineprinters) were based around 80 columns too (10cpi over 8 inches).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to bart on Thu Mar 6 00:46:32 2025
    On Wed, 5 Mar 2025 23:46:13 +0000, bart wrote:

    On 05/03/2025 22:02, Lawrence D'Oliveiro wrote:

    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed
    31.

    So:

    ADD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA TO BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    GIVING CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.

    ? A tight fit for an 80-column card I think.

    All those languages supported line continuation -- right in the middle of
    an identifier or string literal or what-have-you, if necessary.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Janis Papanagnou on Thu Mar 6 01:22:19 2025
    On 2025-03-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 05.03.2025 20:12, Kaz Kylheku wrote:
    On 2025-03-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 05.03.2025 09:39, Richard Heathfield wrote:
    On 05/03/2025 08:35, Janis Papanagnou wrote:
    There's a reason why I dislike languages whose syntax is cluttered
    with parentheses

    (I (bet ((you ((jutht) love) Lithp).)))

    With my first glimpse of lithp code I immediately felt repelled, erm..,
    wrong word - I meant: felt deep and long lasting _respect_ for it. :-)

    But I know there are folks who really love it. - That's fine by me.

    (It's always good if you have options to choose from.)

    Lisp offers ways to break long expressions in multiple ways,
    all falling under the same general algorithm that is easy supported
    in your editor.

    That's why I posted that example:

    (when (or (and (/= a b)
    (/= c d)
    (/= e f))
    (and (= g (* (h)
    (i)))
    (= j k)))
    (foo))

    You just don't have these stylistic issues about where to put
    the operator relative to the operand. [...]

    But isn't that a property of every system specified in either
    Polish Notation (like Lisp) or Reversed Polish Notation, that
    require no parenthesis to evaluate expressions? Interestingly,

    Sort of. If we don't have parentheses, then we just have to know
    the arity of all the functions.

    Lisp syntax can be semantically wrong, yet syntactically correct
    and editable. (cons 1 2 3) would be wrong as a function call,
    but we can write it, and it will parse. Just like calling
    getchar(a,b,c) in C.

    In Polish Notation we can use whitespace to show what the
    operands are:

    or2 and3 /= a b
    /= c d
    /= e f
    and2 = g * h i
    = j k

    I had to invent or2, and3 and and2 to have a fixed arity, otherwise variadic funtions need some symbol to look for indicating the end of their
    argument list, like "dna" to indicate end of "and":

    and /= a b /= c d /= e f dna

    If we collapse it into one line, it becomes visually ambiguous.
    It can't be automatically reformatted without the reformatter
    understanding the arity of everything.

    or2 and3 /= a b /= c d /= e f and2 = g * h i = j k

    Lisp (employing such a in principle parenthesis-free language)

    It doesn't employ an in principle parenthesis-free language.
    It employs a data language in which you can write tree nodes
    of any arity you want, which can be interpreted as code.

    Many functions and operators in Lisp are varaidic.

    It's just a function application notation f(x, y, ...)
    where the commas have been deleted f(x y ...)
    and then the left parenthesis has beem moved to include
    the function: (f x y ...) so it's like a command language
    with parentheses around commands.

    We see a similar thing in the shell command substitution:

    var=$(echo a b c $(cat file))

    GNU Make:

    $(foreach i,a b c,$(addprefix $(i)/foo))


    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Thu Mar 6 02:34:30 2025
    On Wed, 5 Mar 2025 09:58:45 +0100, Janis Papanagnou wrote:

    With my first glimpse of lithp code I immediately felt repelled ...

    I suspect at least part of that is down to the traditional code
    layout, where an accumulation of opening parentheses from various
    prior lines are all closed at once on a single line. I call this the “parenthesis pileup” layout.

    Here’s a sample of how I prefer to layout my Lisp code:

    (global-set-key [?\s-o]
    (lambda ()
    "open a file named in the region if there is one, else prompt for a file name."
    (interactive)
    (cond
    ((use-region-p)
    (let (beg end)
    (get-cur-line nil beg end)
    (find-file (buffer-substring beg end))
    ) ; let
    )
    (t
    (call-interactively 'find-file)
    )
    ) ; cond
    ) ; lambda
    ) ; global-set-key

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Thu Mar 6 10:35:53 2025
    On 05/03/2025 23:58, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    [...]
    Is that "Dr Matrix" a joke?

    Yes.

    https://en.wikipedia.org/wiki/Irving_Joshua_Matrix


    It was immediately obvious to me that it was a joke, but I did not
    realise it was an established fictional character - I was going to give
    credit to Richard for his imaginative humour! So thanks to both of you
    for broadening my cultural knowledge. (I've enjoyed a number of books
    and other writing by Martin Gardner, but hadn't come across Dr. Matrix
    before.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Scott Lurndal on Thu Mar 6 10:29:27 2025
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables.
    Their use for that function in maths /long/ predates Fortran.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to bart on Thu Mar 6 10:53:45 2025
    On 06.03.2025 00:46, bart wrote:
    On 05/03/2025 22:02, Lawrence D'Oliveiro wrote:
    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed
    31.

    So:

    ADD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA TO BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    GIVING CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.

    ? A tight fit for an 80-column card I think.

    I think linker symbols were more limited; on DEC typically 6 characters
    for example.

    Yes, I recall such limits. - Given how C++'s name-mangled identifiers
    are passed this seems different nowadays; shorter identifiers getting
    longer for the linker.


    I suspect the 30 characters were as a much of an arbitrary
    implementation limit as my 255; you wouldn't supposed to get anywhere
    near it.

    Most likely. - Also the habits seem to have been different back these
    days; using shorter names and not "stories" for identifying IT-items.


    Whatever it was you meant by “80-character hardware” (see discussion
    elsewhere) ...

    Punched cards, teletypes and VDUs tended to use 72/80 columns.

    As already mentioned elsethread there have been also other sizes. The
    perceived supremacy of 80 columns cards were probably due to IBM's
    predominance on the IT sector, at least in the contexts I worked in
    or had insights in.

    The first
    text display I owned used 64. I think home or small-business printers
    (not lineprinters) were based around 80 columns too (10cpi over 8 inches).

    I programmed on an Olivetti P6060 around 1980; a system with a BASIC
    compiler. It had a single-line display of 32 characters length, the
    output was on thermo-paper and it could plot and print characters in
    an 80 columns format. I think also the line length of that BASIC was
    restricted to 80 characters. As it was I seem to recall on Commodore
    systems (PET, CBM). A Sharp BASIC pocket calculator from these days
    had also a 80 characters restriction for BASIC programs, its optional thermo-printer supported 24 characters width (but obviously wasn't
    designed for printing other things than numbers); for a disassembler
    that I wrote with compact mnemonics it was sufficient, though.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to bart on Thu Mar 6 14:48:23 2025
    bart <bc@freeuk.com> writes:
    On 05/03/2025 22:02, Lawrence D'Oliveiro wrote:
    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed 31.

    So:

    ADD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA TO BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    GIVING CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.

    ? A tight fit for an 80-column card I think.

    A statement could easily span multiple cards. Do a google search
    on 'COBOL continuation line'.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to David Brown on Thu Mar 6 14:49:26 2025
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables.
    Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Harnden@21:1/5 to Scott Lurndal on Thu Mar 6 17:52:32 2025
    On 06/03/2025 14:49, Scott Lurndal wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables.
    Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    I'd always assumed it was because 'index' was too much to type, and that
    j and k just followed on.

    Didn't know about any hysterical raisins.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Richard Harnden on Thu Mar 6 18:05:12 2025
    On 06/03/2025 17:52, Richard Harnden wrote:
    On 06/03/2025 14:49, Scott Lurndal wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k
    for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index
    variables.
    Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    I'd always assumed it was because 'index' was too much to type,
    and that j and k just followed on.

    Didn't know about any hysterical raisins.

    At school we used a, b, c... for trigonometry and p, q, r for
    point co-ordinates, so I suppose I assumed that i, j, k... for
    matrices was intended to exploit a nice juicy part of the
    alphabet that wasn't being used for anything else...

    ...and then along came imaginary numbers.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Scott Lurndal on Thu Mar 6 20:36:07 2025
    On 06/03/2025 15:49, Scott Lurndal wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables.
    Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    I certainly did not. I use i, j, k in maths, then in BASIC, then in
    Pascal, then in C. No Fortran in sight.

    /Everyone/ uses i, j, k for simple indices, because it is standard in
    maths and is a convention that works well in just about any programming language. Fortran may have been have been one of the first high-level programming languages, but there is no reason to suppose others copied
    this convention from it.

    And while my knowledge of Fortran is close to negligible, I don't
    believe you are /required/ to use i, j or k for indices - people use
    other letters or identifiers for loop counters and indices, just as they
    do in most languages. The only language I know of where you are forced
    to use i and j is FORTH.

    I'm sure that people who first programmed in Fortran, and then in C,
    took some of their habits with them. And there are no doubt plenty of
    features of programming and programming languages that Fortran
    pioneered, and other languages copied - this is not one of them.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Scott Lurndal on Thu Mar 6 20:49:11 2025
    On 2025-03-06, Scott Lurndal <scott@slp53.sl.home> wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop
    counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables. >>Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    This is impossible to to know, because it would require us to have
    access to every historic program, which would have to be accompanied by
    a rationale as to why it chose i.

    When we speculate about this, we cannot ignore the reality that a lot
    of programmers would have had enough of a math background to have seen
    i as an index variable upteen times and used it themselves in numerous
    homework assignments and exam answers.

    It comes to reason that any given programmer uses i as a loop dummy
    for one of two reasons:

    1. They pick up the practice from reference manuals, tutorials,
    other people's code or from programming teachers: their whiteboard
    scribbling or course materials.

    2. They spontaneously choose i due to their math background.

    The second case terminates the recursion. The former case continues
    through other programmers: those who wrote the reference manuals or
    tutorials, or taught the classes. Did they get the "i" from other
    reference manuals, tutorials, source code or programming teachers? Or
    did they spontaneously get it from their math background?

    The idea that i came into all other programming use exclusively through
    Fortran means that no programmer ever came up with i due to their math background, except for those early programmers working with Fortran.
    Fortran programmers "seeded" the letter i into programming, and all
    subsequent use of i in programming traces back to their documentation
    and sources.

    A weaker form of the idea is that "i" did come into programming via
    paths not involving Fortran (e.g. spontaneous use due to someone's math background), but those lineages died out; that all current, surviving
    use of i is (in principle, if not in realistic fact) traceable to
    Fortran sources or docs.

    I would say that, independently of being an utterly unverifiable
    conjecture, either hypothesis is highly improbable.

    The math influence on naming is simply too pervasive for it to have been possible for early Fortran people to have perpetrated an air-tight
    gatekeeping on math-based naming.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Richard Heathfield on Thu Mar 6 21:14:14 2025
    On 2025-03-06, Richard Heathfield <rjh@cpax.org.uk> wrote:
    At school we used a, b, c... for trigonometry and p, q, r for
    point co-ordinates, so I suppose I assumed that i, j, k... for
    matrices was intended to exploit a nice juicy part of the
    alphabet that wasn't being used for anything else...

    ...and then along came imaginary numbers.

    The imaginary i happily coexists with the indexing i.

    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Electrical engineers, on the other hand, came along bearing
    current, and immediately saw the i clash, renaming the
    imaginary i to j.

    However, electrical engineers don't count through any abstract spaces,
    so they don't care about i (current) clashing with i (indexing).

    They count things like resistors (R1, R2, ...), capacitors (C1, C2, ...) integrated circuits (U1, U2, ...), component pins, and so on.

    An EE would never say impractical, goofy things like, "For i from 1
    through n (that being the number of capacitors n in my circuit), such
    and such a facts holds about Ci ..."

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Scott Lurndal on Thu Mar 6 21:18:49 2025
    On 2025-03-06, Scott Lurndal <scott@slp53.sl.home> wrote:
    bart <bc@freeuk.com> writes:
    On 05/03/2025 22:02, Lawrence D'Oliveiro wrote:
    On Wed, 5 Mar 2025 16:40:51 +0000, bart wrote:

    People are forgetting that in the days of 80-character hardware,
    identifiers were often limited to 6 characters or even fewer.

    COBOL allowed for 30 from the beginning, as I recall. And PL/I allowed 31. >>
    So:

    ADD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA TO BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    GIVING CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.

    ? A tight fit for an 80-column card I think.

    A statement could easily span multiple cards. Do a google search
    on 'COBOL continuation line'.

    The "COBOL continuation line" is the result of the ritual when the aging
    king of COBOL in a given geographic region nominates his younger
    successor, passing to him the deck of royal punched cards, and a
    sceptre-like stick for reaching the computer room power switch that
    is mounted ten feet up on the wall.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Kaz Kylheku on Fri Mar 7 08:10:07 2025
    On 06.03.2025 22:18, Kaz Kylheku wrote:
    On 2025-03-06, Scott Lurndal <scott@slp53.sl.home> wrote:

    A statement could easily span multiple cards. Do a google search
    on 'COBOL continuation line'.

    The "COBOL continuation line" is the result of the ritual when the aging
    king of COBOL in a given geographic region nominates his younger
    successor, passing to him the deck of royal punched cards, and a
    sceptre-like stick for reaching the computer room power switch that
    is mounted ten feet up on the wall.

    LOL!

    If only every technical topic could be explained as fancy and poetic
    as this. We could enjoy the profane IT much more. :-)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From G@21:1/5 to David Brown on Fri Mar 7 09:28:35 2025
    David Brown <david.brown@hesbynett.no> wrote:
    On 06/03/2025 15:49, Scott Lurndal wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 05/03/2025 18:51, Scott Lurndal wrote:
    Richard Harnden <richard.nospam@gmail.invalid> writes:
    On 05/03/2025 17:09, Janis Papanagnou wrote:
    On 05.03.2025 17:40, bart wrote:
    [...]


    Seriously, short variable names for common things - i, j, k for loop >>>>> counters;

    So, one might ask _why_ i, j, k instead of a, b, c?

    Answer: Fortran IMPLICIT INTEGER


    Nonsense.

    Ask rather why Fortran picked i, j, k for integer-type index variables.
    Their use for that function in maths /long/ predates Fortran.

    That doesn't mean that C programmers didn't adopt the
    use of i,j,k from FORTRAN.

    I certainly did not. I use i, j, k in maths, then in BASIC, then in
    Pascal, then in C. No Fortran in sight.

    /Everyone/ uses i, j, k for simple indices, because it is standard in
    maths and is a convention that works well in just about any programming language. Fortran may have been have been one of the first high-level programming languages, but there is no reason to suppose others copied
    this convention from it.

    And while my knowledge of Fortran is close to negligible, I don't
    believe you are /required/ to use i, j or k for indices - people use
    other letters or identifiers for loop counters and indices, just as they
    do in most languages. The only language I know of where you are forced
    to use i and j is FORTH.

    I'm sure that people who first programmed in Fortran, and then in C,
    took some of their habits with them. And there are no doubt plenty of features of programming and programming languages that Fortran
    pioneered, and other languages copied - this is not one of them.

    When I was programming in FORTRAN i thought that the fact that "i" to "n"
    where implicitly integer where because they where the initials of "Integer Number", probably a coincidence... but useful to remember it.
    And that was before I learned that the first instruction in any FORTRAN
    program has to be "IMPLICIT NONE", it took almost a day to debug a program
    when I mistakenly wrote "I0UT" instead of "IOUT" using a terminal where "O"
    and "0" where almost identical, the FORTRAN compiler happily accepted it,the program not so much.

    G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Kaz Kylheku on Fri Mar 7 15:37:12 2025
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    On 2025-03-06, Richard Heathfield <rjh@cpax.org.uk> wrote:
    At school we used a, b, c... for trigonometry and p, q, r for
    point co-ordinates, so I suppose I assumed that i, j, k... for
    matrices was intended to exploit a nice juicy part of the
    alphabet that wasn't being used for anything else...

    ...and then along came imaginary numbers.

    The imaginary i happily coexists with the indexing i.

    Yes.


    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.


    Mathematicians come in two varieties - those that can count, and those
    that can't count.

    In my mathematics, I neither relish ambiguity nor am I oblivious to it -
    and I think most mathematicians are like that.

    It is almost always obvious from context whether "i" refers to the
    imaginary number constant, or a counter index. In situations where both
    might be used (such as the summation for a Fourier series), you simply
    use a different letter for the index - j, k, and n are typical.

    Electrical engineers, on the other hand, came along bearing
    current, and immediately saw the i clash, renaming the
    imaginary i to j.


    I've done plenty of electronics design, though I have no formal
    education in electrical engineering. But I think it is quite common to
    use imaginary "i" rather than "j" - it's usually obvious from the
    context when you are talking about a current. It's rare that you only
    have one current of interest in a system, so you already have i1, i2,
    i_in, i_out, or whatever. There is rarely a clash.

    However, electrical engineers don't count through any abstract spaces,
    so they don't care about i (current) clashing with i (indexing).


    Of course electrical engineers count loops.

    They count things like resistors (R1, R2, ...), capacitors (C1, C2, ...) integrated circuits (U1, U2, ...), component pins, and so on.


    And they loop through these things - consider multi-stage filters,
    transmission line models, etc.

    An EE would never say impractical, goofy things like, "For i from 1
    through n (that being the number of capacitors n in my circuit), such
    and such a facts holds about Ci ..."


    They could quite happily talk about the sum of load capacitors C_i on a bus.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to All on Fri Mar 7 21:16:49 2025
    On 7 Mar 2025 09:28:35 GMT, G wrote:

    And that was before I learned that the first instruction in any FORTRAN program has to be "IMPLICIT NONE" ...

    Meeting several University support people who used to help users with
    their Fortran programs, back in the day, there was frequent agreement with
    the policy “no help unless each compilation unit has IMPLICIT NONE at the start”.

    GNU Fortran even has a command-line option to put an implicit IMPLICIT
    NONE into each compilation unit.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Keith Thompson on Sat Mar 8 16:47:51 2025
    On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, and those
    that can't count.

    Mathematicians come in three varieties - those that can count, and those
    that can't count. The third variety is left as an exercise for the
    student.


    There are two sorts of people. Those that can infer from missing data.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Richard Harnden on Sun Mar 9 11:41:23 2025
    Richard Harnden <richard.nospam@gmail.invalid> writes:

    On 04/03/2025 18:14, Kaz Kylheku wrote:

    On 2025-03-04, bart <bc@freeuk.com> wrote:

    The style I use for generated code is like this:

    if (cond) {
    stmt1;
    }
    else {
    stmt2;
    }

    I've been known to do this:

    if (case_ineligible_for_switch) {
    // ...
    } else switch (state_variable) {
    // ...
    }

    or

    if (case_not_requiring_loop) {
    // ...
    } else for (;;) {
    // ...
    }

    and I might even have historically perpetrated something like:

    if (case_not_requiring_loop) {
    // ...
    } else if (case_requiring_loop) for (;;) {
    // ...
    } else {
    // ...
    }

    I like the brace on its own line. It visually separates the
    condidition from the statement.

    If someone wants visual separation, that can be done just
    as well or better with a blank line.

    How do people format long and complex conditions, given that
    you're trying not to a much over 80 columns?

    In almost all cases, revise the code so that conditions in if(),
    while(), etc, result in a line not over 80 columns. There are
    various ways of doing this, such as factoring the condition into a
    function, introducing auxiliary variables for sub-conditions, and so
    forth.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Sun Mar 9 12:18:39 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    David Brown <david.brown@hesbynett.no> writes:

    On 26/02/2025 15:39, Bradley K. Sherman wrote:

    Just do your best to keep it neat and under 80 columns.

    Neat, yes. 80 columns, no - unless you are living in the previous
    century.

    Lines that are too long are hard to read, but the idea that 80
    columns is a good number or should be a hard limit is /long/
    outdated. [...]

    These statements exemplify the sort of tripe offered by people who
    have strong opinions but no facts. Proof by innuendo.

    I tend to prefer the 80 column constraint. I use vim with both
    horizontal and vertical splits to work on a codebase with several
    hundred source files; 80-column lines are much easier to read in
    that environment, where each split may only be 80 columns wide
    with two or three vertical splits available on a wide (16x9)
    screen.

    Makes it easly to move between files/splits using the keyboard,
    especially useful over ssh.

    I often read code on 8.5 by 11 paper. I find using that medium
    gives me a wider focus, and lets me understand how code fits
    together on a large scale, better than looking at code on a
    display, even a very large one. Having more than 80 columns per
    line when using a paper medium makes the characters smaller, and
    IME increases the amount of effort and energy needed when reading,
    which consequently limits the amount of time I can spend reviewing
    and understanding code. There are other reasons to want to limit
    line lengths to something near 80 columns, but the effect of output
    on standard paper media is one of the most compelling.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Tim Rentsch on Sun Mar 9 22:30:00 2025
    On 09.03.2025 20:18, Tim Rentsch wrote:

    I often read code on 8.5 by 11 paper. I find using that medium
    gives me a wider focus, and lets me understand how code fits
    together on a large scale, better than looking at code on a
    display, even a very large one.

    Oh, I wouldn't have expected that there's something here where I
    can agree with you. Or only disagree in that I'd prefer A4 format
    (instead of US Letter). Though I wouldn't expect that many folks
    still prefer (for a better overview) paper to displays. More so
    if we consider that common (e.g. 24") screens have an area that
    even exceeds two A4 papers put side by side horizontally.

    Another thing is that folks (me included) not only read source
    code but also search and navigate source code. So unless some
    'paper-grep' gets developed - a feature I've been seeking since
    decades! - paper is not exactly good as reason for a 80 columns
    discussion (i.e. beyond the upthread already mentioned general
    better readability property of smaller text widths in printed
    media).

    Paper of course has yet some other advantages; for me, I inspect
    or study the papers at the sunny balcony, with my head comfortably
    lowered, and I don't carry 24" displays around and don't want to
    have lighting issues (with reflections and brightness). And with
    two hands you can hold two papers one below the other too look
    over 120-130 lines of code at once (assuming separate papers and
    not continuous listing paper that allows even more). ;-)

    Having more than 80 columns per
    line when using a paper medium makes the characters smaller, and
    IME increases the amount of effort and energy needed when reading,
    which consequently limits the amount of time I can spend reviewing
    and understanding code.

    It depends. In cases where you're focusing on structure than on
    details of content smaller fonts are advantageous. In programming
    there's a mixture of looking at contents and structure[*]. Here
    the advantage of screens with a scalable font size beats paper;
    you can adjust windows and fonts to fit actual necessities. YMMV.
    (And there's yet more useful functions available, like folding.)

    [*] That's a difference to left-aligned, blocked prose text, BTW.

    There are other reasons to want to limit
    line lengths to something near 80 columns, but the effect of output
    on standard paper media is one of the most compelling.

    Back in the days when paper was more commonly used I often printed
    source code with a2ps in its default mode, which was 2 print pages
    side by side on a landscape A4 paper (with a scaling equivalent of
    ~71%); for 80-column programs that was fine - more columns would
    result in extremely annoying line wrapping, which is actually the
    primary reason for me to typically not use lines larger than these
    80 columns (that a lot of devices, tools, programs, and standards
    rely on). That equally holds for displays and for output on paper!

    One aspect when working together with others on the same source is
    important to be aware of; cleanly formatted 80-columns source code
    can be trivially read by "anyone", but larger lines that wrap on
    smaller devices (or on paper, if you like) is an unnecessary pain
    for others; I would even call it anti-social. :-)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Janis Papanagnou on Mon Mar 10 13:21:23 2025
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

    On 09.03.2025 20:18, Tim Rentsch wrote:

    I often read code on 8.5 by 11 paper. I find using that medium
    gives me a wider focus, and lets me understand how code fits
    together on a large scale, better than looking at code on a
    display, even a very large one.

    Oh, I wouldn't have expected that there's something here where I
    can agree with you. Or only disagree in that I'd prefer A4 format
    (instead of US Letter).

    A4 format is narrower than US letter, which strengthens the
    argument for limiting to (around) 80 columns.

    Though I wouldn't expect that many folks
    still prefer (for a better overview) paper to displays. More so
    if we consider that common (e.g. 24") screens have an area that
    even exceeds two A4 papers put side by side horizontally.
    [other comparisons]

    I don't think of paper as a replacement for an interactive display.
    It offers advantages along some axes, disadvantages along others.
    I think it's a mistake to exclude either one.

    Having more than 80 columns per
    line when using a paper medium makes the characters smaller, and
    IME increases the amount of effort and energy needed when reading,
    which consequently limits the amount of time I can spend reviewing
    and understanding code.

    It depends. In cases where you're focusing on structure than on
    details of content smaller fonts are advantageous. In programming
    there's a mixture of looking at contents and structure[*]. Here
    the advantage of screens with a scalable font size beats paper;
    you can adjust windows and fonts to fit actual necessities. YMMV.
    (And there's yet more useful functions available, like folding.)

    [*] That's a difference to left-aligned, blocked prose text, BTW.

    I'm talking about cases where reading the content is an important
    part of the activity. If what I'm interested in is an overview,
    rather than the content, I would choose a different representation
    than simply some sort of scaling of the original source text.

    There are other reasons to want to limit
    line lengths to something near 80 columns, but the effect of output
    on standard paper media is one of the most compelling.

    Back in the days when paper was more commonly used I often printed
    source code with a2ps in its default mode, which was 2 print pages
    side by side on a landscape A4 paper (with a scaling equivalent of
    ~71%); for 80-column programs that was fine - more columns would
    result in extremely annoying line wrapping, which is actually the
    primary reason for me to typically not use lines larger than these
    80 columns (that a lot of devices, tools, programs, and standards
    rely on). That equally holds for displays and for output on paper!

    One aspect when working together with others on the same source is
    important to be aware of; cleanly formatted 80-columns source code
    can be trivially read by "anyone", but larger lines that wrap on
    smaller devices (or on paper, if you like) is an unnecessary pain
    for others; I would even call it anti-social. :-)

    I agree with the sentiment here. People who say, for example, 120+
    character lines are okay, are focused primarily on their own views
    (both literally and figuratively) at the expense of others.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Richard Heathfield on Tue Mar 11 22:11:30 2025
    Richard Heathfield <rjh@cpax.org.uk> writes:

    On 28/02/2025 12:19, Michael S wrote:

    On Fri, 28 Feb 2025 10:24:19 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 28/02/2025 09:22, David Brown wrote:

    As long as it's not "Long time no C" :-)

    I'm afraid it is. Nowadays I spend most of my time arguing with
    \LaTeX, although when I do cut code it is in C (and that's proper
    C, of course, not this newfangled gibberish).

    one man's newfangled gibberish is another man's proper C

    Agreed. On the other hand, it is easy to overlook the virtue of
    stability, and change does not necessarily imply progress.

    C is quite stable in the sense that in most cases C90 code is
    acceptable under C99 or C11 rules. I think there are four kinds
    of differences that someone might want to avoid.

    One, some C90 features were removed from C99. The obvious
    examples are implicit 'int' type and implicit function
    declaration.

    Two, some constructs are allowed in both C90 and C99 but have
    different semantics, or possibly different semantics. One
    example is what precision is used in expressions evaluated in the
    C preprocessor. Another example is integer division, which is
    well-defined in C99 but only implementation-defined in C90.

    Three, in some cases code that is legal in C90 is not legal in
    C99 (and not because features are just removed as in case one).
    The most obvious examples involve the use of new keywords such as
    'inline' and 'restrict' as ordinary identifiers.

    Four, use of constructs that are newly allowed in C99 and are
    (obviously) legal under C99 rules but would cause diagnostics
    under C90 rules. An example is allowing a trailing comma in
    definitions of 'enum' types. If someone were to want non-C90
    code (even only certain non-C90 constructs) to be given a
    diagnostic then obviously using C99 or later would prevent that.

    Are any of these cases ones that you find objectionable or would
    cause difficulty for code that you work on? If so which ones?
    My question here is meant to ask about specifics, not just
    general categories. And to be clear, I don't mean to limit the
    set of potential problems being considered to just the examples
    given above.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Tim Rentsch on Wed Mar 12 06:52:33 2025
    On 12/03/2025 05:11, Tim Rentsch wrote:
    Are any of these cases ones that you find objectionable

    In my capacity as grumpy old git? All of them, of course.

    For sound practical reasons? No, of course not.

    But the importance of grump should not be under-estimated.

    or would
    cause difficulty for code that you work on? If so which ones?
    My question here is meant to ask about specifics, not just
    general categories. And to be clear, I don't mean to limit the
    set of potential problems being considered to just the examples
    given above.

    I suppose what I'm trying to get at is that there is merit in
    having a small, well-defined, well-known language that doesn't
    keep buzzing around. People who want bells and whistles can
    undoubtedly find them in other languages, so why insist on
    dragging them into C as well when they're so rarely a good fit,
    like trying to split an infinitive... in Latin?

    So no, Tim; it's not for specific technical reasons, but more for
    the sake of having one widely-known language that really is a
    lingua franca and valuable for that very reason.

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Richard Heathfield on Wed Mar 12 11:12:51 2025
    On Wed, 12 Mar 2025 06:52:33 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 12/03/2025 05:11, Tim Rentsch wrote:
    Are any of these cases ones that you find objectionable

    In my capacity as grumpy old git? All of them, of course.


    Even in your capacity as grumpy old git you can be more concrete.

    For sound practical reasons? No, of course not.

    But the importance of grump should not be under-estimated.

    or would
    cause difficulty for code that you work on? If so which ones?
    My question here is meant to ask about specifics, not just
    general categories. And to be clear, I don't mean to limit the
    set of potential problems being considered to just the examples
    given above.

    I suppose what I'm trying to get at is that there is merit in
    having a small, well-defined, well-known language that doesn't
    keep buzzing around. People who want bells and whistles can
    undoubtedly find them in other languages, so why insist on
    dragging them into C as well when they're so rarely a good fit,
    like trying to split an infinitive... in Latin?

    So no, Tim; it's not for specific technical reasons, but more for
    the sake of having one widely-known language that really is a
    lingua franca and valuable for that very reason.


    So far it looks like hand waving.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Michael S on Wed Mar 12 09:23:10 2025
    On 12/03/2025 09:12, Michael S wrote:
    On Wed, 12 Mar 2025 06:52:33 +0000
    Richard Heathfield <rjh@cpax.org.uk> wrote:

    On 12/03/2025 05:11, Tim Rentsch wrote:
    Are any of these cases ones that you find objectionable

    In my capacity as grumpy old git? All of them, of course.


    Even in your capacity as grumpy old git you can be more concrete.

    For sound practical reasons? No, of course not.

    But the importance of grump should not be under-estimated.

    or would
    cause difficulty for code that you work on? If so which ones?
    My question here is meant to ask about specifics, not just
    general categories. And to be clear, I don't mean to limit the
    set of potential problems being considered to just the examples
    given above.

    I suppose what I'm trying to get at is that there is merit in
    having a small, well-defined, well-known language that doesn't
    keep buzzing around. People who want bells and whistles can
    undoubtedly find them in other languages, so why insist on
    dragging them into C as well when they're so rarely a good fit,
    like trying to split an infinitive... in Latin?

    So no, Tim; it's not for specific technical reasons, but more for
    the sake of having one widely-known language that really is a
    lingua franca and valuable for that very reason.


    So far it looks like hand waving.

    Of course. And so do the (to me, spurious) reasons offered for
    changing the language in the first place. If those reasons have
    convinced you, you're not going to be convinced back by a
    rigorous analysis, so why bother? Besides, the ship has obviously
    sailed, and all that remains to me is my opinion... oh, and my
    -ansi -pedantic flags.

    I'll bet that even to this day there are some grumpy old gits out
    there decrying Fortran 90 and insisting that FORTRAN 77 is far
    superior...

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From candycanearter07@21:1/5 to David Brown on Wed Mar 12 22:20:04 2025
    David Brown <david.brown@hesbynett.no> wrote at 15:47 this Saturday (GMT):
    On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, and those
    that can't count.

    Mathematicians come in three varieties - those that can count, and those
    that can't count. The third variety is left as an exercise for the
    student.


    There are two sorts of people. Those that can infer from missing data.


    There are 10 kinds of people, people who know binary and those who
    don't.
    --
    user <candycane> is generated from /dev/urandom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Richard Heathfield on Thu Mar 13 00:06:03 2025
    On Wed, 12 Mar 2025 09:23:10 +0000, Richard Heathfield wrote:

    I'll bet that even to this day there are some grumpy old gits out there decrying Fortran 90 and insisting that FORTRAN 77 is far superior...

    Fortran 77 didn’t have DO ... END DO.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Keith Thompson on Thu Mar 13 00:12:26 2025
    On 2025-03-12, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    writes:
    David Brown <david.brown@hesbynett.no> wrote at 15:47 this Saturday (GMT): >>> On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, and those >>>>> that can't count.

    Mathematicians come in three varieties - those that can count, and those >>>> that can't count. The third variety is left as an exercise for the
    student.

    There are two sorts of people. Those that can infer from missing data.

    There are 10 kinds of people, people who know binary and those who
    don't.

    There are 01 kinds of people, those who understand little-endian
    notation and those who don't.

    There are '\0002' kinds of people: those who understand that a C octal character escape is restricted to three digits, and those who
    drag their knuckles on the ground when they try to walk on their
    hind legs.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Kaz Kylheku on Thu Mar 13 09:30:47 2025
    On 13/03/2025 01:12, Kaz Kylheku wrote:
    On 2025-03-12, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    writes:
    David Brown <david.brown@hesbynett.no> wrote at 15:47 this Saturday (GMT): >>>> On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, and those >>>>>> that can't count.

    Mathematicians come in three varieties - those that can count, and those >>>>> that can't count. The third variety is left as an exercise for the
    student.

    There are two sorts of people. Those that can infer from missing data. >>>
    There are 10 kinds of people, people who know binary and those who
    don't.

    There are 01 kinds of people, those who understand little-endian
    notation and those who don't.

    There are '\0002' kinds of people: those who understand that a C octal character escape is restricted to three digits, and those who
    drag their knuckles on the ground when they try to walk on their
    hind legs.


    There are two sorts of people - those that can be divided into two sorts
    of people, and those that can't.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to David Brown on Thu Mar 13 09:44:31 2025
    On 2025-03-13, David Brown <david.brown@hesbynett.no> wrote:
    On 13/03/2025 01:12, Kaz Kylheku wrote:
    On 2025-03-12, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    writes:
    David Brown <david.brown@hesbynett.no> wrote at 15:47 this Saturday (GMT): >>>>> On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious
    to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, and those >>>>>>> that can't count.

    Mathematicians come in three varieties - those that can count, and those >>>>>> that can't count. The third variety is left as an exercise for the >>>>>> student.

    There are two sorts of people. Those that can infer from missing data. >>>>
    There are 10 kinds of people, people who know binary and those who
    don't.

    There are 01 kinds of people, those who understand little-endian
    notation and those who don't.

    There are '\0002' kinds of people: those who understand that a C octal
    character escape is restricted to three digits, and those who
    drag their knuckles on the ground when they try to walk on their
    hind legs.


    There are two sorts of people - those that can be divided into two sorts
    of people, and those that can't.

    There are two sorts of people: unstable sorts, which leave identical
    twins in an unpredictable order, and stable sorts, which preserve their original order.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Kaz Kylheku on Thu Mar 13 16:19:04 2025
    On Thu, 13 Mar 2025 09:44:31 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:

    On 2025-03-13, David Brown <david.brown@hesbynett.no> wrote:
    On 13/03/2025 01:12, Kaz Kylheku wrote:
    On 2025-03-12, Keith Thompson <Keith.S.Thompson+u@gmail.com>
    wrote:
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    writes:
    David Brown <david.brown@hesbynett.no> wrote at 15:47 this
    Saturday (GMT):
    On 07/03/2025 21:17, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 06/03/2025 22:14, Kaz Kylheku wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious >>>>>>>> to ambiguity and those who relish it. This i situation goes
    unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count,
    and those that can't count.

    Mathematicians come in three varieties - those that can count,
    and those that can't count. The third variety is left as an
    exercise for the student.

    There are two sorts of people. Those that can infer from
    missing data.

    There are 10 kinds of people, people who know binary and those
    who don't.

    There are 01 kinds of people, those who understand little-endian
    notation and those who don't.

    There are '\0002' kinds of people: those who understand that a C
    octal character escape is restricted to three digits, and those who
    drag their knuckles on the ground when they try to walk on their
    hind legs.


    There are two sorts of people - those that can be divided into two
    sorts of people, and those that can't.

    There are two sorts of people: unstable sorts, which leave identical
    twins in an unpredictable order, and stable sorts, which preserve
    their original order.


    There are two sorts of people: those that find jokes about two sorts of
    people amusing and myself.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Michael S on Thu Mar 13 16:20:24 2025
    On 13.03.2025 15:19, Michael S wrote:
    The usual suspects wrote:
    [...]
    Mathematicians come in two varieties: those who are oblivious >>>>>>>>>> to ambiguity and those who relish it. This i situation goes >>>>>>>>>> unnoticed by the former, and pleases the latter.

    Mathematicians come in two varieties - those that can count, >>>>>>>>> and those that can't count.

    Mathematicians come in three varieties - those that can count, >>>>>>>> and those that can't count. The third variety is left as an
    exercise for the student.

    There are two sorts of people. Those that can infer from
    missing data.

    There are 10 kinds of people, people who know binary and those
    who don't.

    There are 01 kinds of people, those who understand little-endian
    notation and those who don't.

    There are '\0002' kinds of people: those who understand that a C
    octal character escape is restricted to three digits, and those who
    drag their knuckles on the ground when they try to walk on their
    hind legs.

    There are two sorts of people - those that can be divided into two
    sorts of people, and those that can't.

    There are two sorts of people: unstable sorts, which leave identical
    twins in an unpredictable order, and stable sorts, which preserve
    their original order.

    There are two sorts of people: those that find jokes about two sorts of people amusing and myself.

    Amassed they might look boring, especially if they follow the same
    building principle. But there's various types here, and that's nice.
    Personally I like the recursive one a lot! (It also reminds me the
    "Life of Brian" movie concerning individuals.)

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Richard Heathfield on Sat Mar 15 09:26:18 2025
    Richard Heathfield <rjh@cpax.org.uk> writes:

    On 12/03/2025 05:11, Tim Rentsch wrote:

    Are any of these cases ones that you find objectionable

    In my capacity as grumpy old git? All of them, of course.

    For sound practical reasons? No, of course not.

    But the importance of grump should not be under-estimated.

    or would
    cause difficulty for code that you work on? If so which ones?
    My question here is meant to ask about specifics, not just
    general categories. And to be clear, I don't mean to limit the
    set of potential problems being considered to just the examples
    given above.

    I suppose what I'm trying to get at is that there is merit in having
    a small, well-defined, well-known language that doesn't keep buzzing
    around. [...]

    C99 is a small, well-defined, well-known language that doesn't keep
    buzzing around. C99 hasn't changed in more than a quarter of a
    century.

    So no, Tim; it's not for specific technical reasons, but more for
    the sake of having one widely-known language that really is a lingua
    franca and valuable for that very reason.

    These days it is C99 that is more common than C90, just as today's
    "lingua franca" is English rather than French.

    So it looks like the grump factor is the only factor actually taking
    part in the decision here.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Heathfield@21:1/5 to Tim Rentsch on Sat Mar 15 18:23:32 2025
    On 15/03/2025 16:26, Tim Rentsch wrote:
    So it looks like the grump factor is the only factor actually taking
    part in the decision here.

    Works for me. ;-)

    --
    Richard Heathfield
    Email: rjh at cpax dot org dot uk
    "Usenet is a strange place" - dmr 29 July 1999
    Sig line 4 vacant - apply within

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Keith Thompson on Fri Mar 21 02:41:27 2025
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    Source: <https://en.wikipedia.org/wiki/Punched_card>

    I'll just note that the fact that 80 is an arbitrary number,
    based on technologies we no longer use, [...]

    The choice of using 80 columns was constrained by what technology
    was available at the time, but it's wrong to describe the value
    as arbitrary. We know that a choice was made between a much
    lower number (between 40 and 50 IIRC) and the higher number 80.
    That decision already means the value used was not arbitrary.
    Also we don't know what other factors might have gone into the
    decision; it's possible that IBM settled on 80 only after
    considering what line lengths needed to be supported. We don't
    know what would have happened if, for example, it had been
    discovered that using rectangular holes would allow up to only
    60 columns, perhaps encouraging the introduction of newer
    equipment. We also don't know if someone had looked at how
    many characters were needed in typical printed material, and
    pushed the rectangular hole technology only as far as was needed
    to support that. It seems reasonable to expect that IBM would
    have considered such issues, even in the 1920s, and not just
    ignore them.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Tim Rentsch on Fri Mar 21 14:06:50 2025
    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    I have a hardcover book about punched cards somewhere
    in storage - came from the Burroughs library when they
    closed it. I'll try to dig it out if I get a chance.

    Casey, Robert S. and Perry, James W. Editors
    Punched Cards - Their application to science and industry

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Scott Lurndal on Fri Mar 21 14:08:50 2025
    scott@slp53.sl.home (Scott Lurndal) writes:
    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    I have a hardcover book about punched cards somewhere
    in storage - came from the Burroughs library when they
    closed it. I'll try to dig it out if I get a chance.

    Casey, Robert S. and Perry, James W. Editors
    Punched Cards - Their application to science and industry

    https://archive.org/stream/PunchedCardsTheirApplicationsToScienceAndIndustry/Punched_cards-their_applications_to_science_and_industry_djvu.txt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Sat Mar 22 06:49:12 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    scott@slp53.sl.home (Scott Lurndal) writes:

    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    I have a hardcover book about punched cards somewhere
    in storage - came from the Burroughs library when they
    closed it. I'll try to dig it out if I get a chance.

    Casey, Robert S. and Perry, James W. Editors
    Punched Cards - Their application to science and industry

    https://archive.org/stream/
    PunchedCardsTheirApplicationsToScienceAndIndustry/
    Punched_cards-their_applications_to_science_and_industry_djvu.txt

    A remarkable document. Thank you for the link.

    I perused it only briefly before deciding that the 600+ pages
    (or is it 900+ pages?) had a lot more material than what I
    was willing to tackle.

    Thinking it might be interesting, I gathered some information and
    statistics from the contents, in particular having to do with
    line widths. After eliminating lines that looked like overly
    long gibberish (hundreds or thousands of characters), lines that
    looked like they were meant to be set in a smaller font (mostly
    footnotes and figure captions), and discarding lines shorter than
    66 characters (because they are probably short lines at the end
    of a paragraph), I came up with these results.

    17308 lines, ranging from 66 to 91 characters
    average: 73.95 characters
    std dev: 3.48 characters


    length percent prcntile
    ------ ------- --------
    66 1.01 1.01
    67 1.63 2.64
    68 2.62 5.26
    69 4.06 9.32
    70 6.07 15.39
    71 8.35 23.75
    72 10.62 34.37
    73 11.97 46.33
    74 11.88 58.21
    75 11.36 69.57
    76 9.58 79.15
    77 6.75 85.90
    78 4.88 90.78
    79 3.09 93.87
    80 2.19 96.06
    81 1.39 97.45
    82 0.91 98.35
    83 0.69 99.05
    84 0.47 99.52
    85 0.21 99.73
    86 0.13 99.86
    87 0.07 99.93
    88 0.06 99.99
    91 0.01 100.00


    Notes:

    There were only two lines of length 91. I couldn't tell if they
    were distinct in some way from the other lines (other than being
    longer).

    In some cases the line widths are probably too high, because of
    html-isms like &lt; and so forth.

    I expect the book uses proportionally spaced fonts rather than
    fixed-width fonts, but the contents are part of a <pre></pre>
    block so that's just a guess.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Tim Rentsch on Sat Mar 22 14:32:14 2025
    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
    scott@slp53.sl.home (Scott Lurndal) writes:

    scott@slp53.sl.home (Scott Lurndal) writes:

    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    I have a hardcover book about punched cards somewhere
    in storage - came from the Burroughs library when they
    closed it. I'll try to dig it out if I get a chance.

    Casey, Robert S. and Perry, James W. Editors
    Punched Cards - Their application to science and industry

    https://archive.org/stream/
    PunchedCardsTheirApplicationsToScienceAndIndustry/
    Punched_cards-their_applications_to_science_and_industry_djvu.txt

    A remarkable document. Thank you for the link.

    The hardcover has nice B&W pictures of most of the gear.

    The text document on archive.org is a poorly formatted scan thereof.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Scott Lurndal on Sat Mar 22 12:45:43 2025
    scott@slp53.sl.home (Scott Lurndal) writes:

    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

    scott@slp53.sl.home (Scott Lurndal) writes:

    scott@slp53.sl.home (Scott Lurndal) writes:

    Tim Rentsch <tr.17687@z991.linuxsc.com> writes:

    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

    IBM developed 80-column cards, with the same overall size, in
    the late 1920s. Apparently 80 just happened to be the number
    of rectangular holes that could reasonably be accommodated
    [...]

    We don't know that. The same size might have accommodated 85
    columns, but was revised down to 80 for other reasons. Or the
    same size might have accommodated only 77 columns, but it was
    discovered that 80 columns could work if a different card
    material was used. The form factor was one constraint, but
    not the only constraint, and not the only consideration.

    I have a hardcover book about punched cards somewhere
    in storage - came from the Burroughs library when they
    closed it. I'll try to dig it out if I get a chance.

    Casey, Robert S. and Perry, James W. Editors
    Punched Cards - Their application to science and industry

    https://archive.org/stream/
    PunchedCardsTheirApplicationsToScienceAndIndustry/
    Punched_cards-their_applications_to_science_and_industry_djvu.txt

    A remarkable document. Thank you for the link.

    The hardcover has nice B&W pictures of most of the gear.

    The text document on archive.org is a poorly formatted scan thereof.

    Yes, that was more or less what I assumed is the case.

    The poorly formatted scan does appear to preserve line
    boundaries, however.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)