• Re: technology discussion ? does the world need a "new" C ?

    From dave_thompson_2@comcast.net@21:1/5 to ldo@nz.invalid on Sun Aug 25 16:59:03 2024
    On Sat, 6 Jul 2024 07:25:06 -0000 (UTC), Lawrence D'Oliveiro
    <ldo@nz.invalid> wrote:

    On Fri, 05 Jul 2024 19:00:58 -0700, Keith Thompson wrote:

    C assumes byte addressibility, but it doesn't assume that bytes are 8
    bits.

    The PDP-10 had 36-bit words and could operate on bit fields of any size from 1 to 36 bits.

    But it couldn’t address them.

    Yes it could, but only with specific instructions (LDB ILDB DPB IDPB
    IBP) not the much more varied (even weird) word and halfword insns.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From dave_thompson_2@comcast.net@21:1/5 to Keith.S.Thompson+u@gmail.com on Sun Aug 25 17:16:04 2024
    On Fri, 12 Jul 2024 09:54:46 -0700, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    [snip]
    I know that "call by reference" is the usual formal term, but I
    personally prefer "pass by reference".

    The terms "call by reference" and "call by value" emphasize the call, implying that all arguments in a given call are passed with the same mechanism. In some languages that's true (C argument passing is purely
    by value, and Fortran, as I understand it, is purely by reference), but

    Nope. Since 1990 Fortran supports several options for argument passing
    -- optionally including some that provide interoperability with (at
    least one implementation of) C! -- but even taking 'classic' FORTRAN
    either reference or copyin-copyout was allowed, and important
    compilers (like IBM) were known to use both. Until c.l.f recently
    lapsed into desuetude, this was a FAQ -- "this dusty-deck code doesn't
    work as I expected on the basis that FORTRAN used to be by-ref" ->
    "you expected wrong".

    OTOH COBOL did make everything by-reference, at least up to 1985. And
    I believe PL/I, but I didn't get deeply into that.

    FORTH, like C, was always by-value where the value could be an address
    -- with no target type information (like C void*).

    in others (C++, Pascal, Ada) you can select by-value or by-reference for
    each parameter. "Pass by (reference|value)" feels more precise.

    C++ and Pascal -- and algol68 -- yes. Ada no, or not standardly; it
    specifies a few types that must be by-value and a few more that must
    be by-reference (mostly ones that can't be copied safely, or at all),
    and for everything else lets the compiler choose. I'm unsure if the
    standard allows extension(s) about this, but even if so I doubt it
    would be popular with Ada users (demotivating implementors).

    I haven't checked, but I suspect the terms "call by (reference|value)" predate languages that allowed the mechanism to be specified for each parameter.

    Definitely.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)