• Inversion-of-control and dependency-injection in C

    From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Thu Nov 12 09:41:04 2026
    From Newsgroup: comp.lang.c

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    A usual account for example might recount component frameworks,
    like COM or XPCOM for example, about the concepts of components,
    vis-a-vis, modularity and composability, and, satisfaction of
    dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
    then about adapters to dependencies, or as for resources, that
    it's a bunch of makefiles with various accounts of conditional includes
    and build targets about static and dynamic linking and the toolchain,
    with regards to test-harness and runtime-framework and about
    metaprogramming when making code generation and boilerplate and so on.


    Defining an interface or layer is often enough about groups of functions associated with context-structs to make for lifecycles
    of what result alike the pure virtual or abstract or interfaces
    in reference to languages like C++, about families of functions
    according to the types of their signatures, then as with regards
    to componentry rather generally in value-types and interface-types
    like "variant" and "queryInterface()", about components that implement
    multiple interfaces vis-a-vis mostly about "constructing the
    object-graph" what makes for separation-of-concerns and composability,
    is mostly about modularity and composability.

    Then considerations of modularity as for library design affect to
    reflect on how to indicate responsibilities of ownership in resources,
    for example to hide contract & behavior of resources acquire/release.

    What I'm figuring is that basically there is a flat name-space of
    functions, there are .h and .c files (and may include "portable
    assembler"), and there is the compiler-toolchain, and make or
    build-scripts. Since there are only functions then dependencies their references would basically live in structs (in structs, in structs, ...,
    of function pointers), much like languages with classes and their
    instances objects and subclassing overriding behavior keeping in
    contract, about how to define "runtime-module" vis-a-vis "source module"
    (.o files after compilation-units), about conditional-includes
    and conditional-builds vis-a-vis name-mangling or the conventions of
    symbols.

    What, whither, when, how?

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Nov 12 20:25:40 2026
    From Newsgroup: comp.lang.c

    Ross Finlayson pisze:
    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    A usual account for example might recount component frameworks,
    like COM or XPCOM for example, about the concepts of components,
    vis-a-vis, modularity and composability, and, satisfaction of
    dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
    then about adapters to dependencies, or as for resources, that
    it's a bunch of makefiles with various accounts of conditional includes
    and build targets about static and dynamic linking and the toolchain,
    with regards to test-harness and runtime-framework and about
    metaprogramming when making code generation and boilerplate and so on.


    Defining an interface or layer is often enough about groups of functions associated with context-structs to make for lifecycles
    of what result alike the pure virtual or abstract or interfaces
    in reference to languages like C++, about families of functions
    according to the types of their signatures, then as with regards
    to componentry rather generally in value-types and interface-types
    like "variant" and "queryInterface()", about components that implement multiple interfaces vis-a-vis mostly about "constructing the
    object-graph" what makes for separation-of-concerns and composability,
    is mostly about modularity and composability.

    Then considerations of modularity as for library design affect to
    reflect on how to indicate responsibilities of ownership in resources,
    for example to hide contract & behavior of resources acquire/release.

    What I'm figuring is that basically there is a flat name-space of
    functions, there are .h and .c files (and may include "portable
    assembler"), and there is the compiler-toolchain, and make or
    build-scripts. Since there are only functions then dependencies their references would basically live in structs (in structs, in structs, ...,
    of function pointers), much like languages with classes and their
    instances objects and subclassing overriding behavior keeping in
    contract, about how to define "runtime-module" vis-a-vis "source module"
    (.o files after compilation-units), about conditional-includes
    and conditional-builds vis-a-vis name-mangling or the conventions of
    symbols.

    What, whither, when, how?


    this is not a large group and stating such soecific and wide question
    you minimalise the chance of answers to it to nearly zero

    you can enentually "answer to yourself" (as some say i do? well if i
    state question and some cant answer it after some time i myself may
    answer it) - though im usually not answering my own questions
    (sometimes) but simply "adding" more thoughts to prewious ones
    (which is qute good coz articles splitted on more parts ere better)


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c on Thu Nov 12 20:38:19 2026
    From Newsgroup: comp.lang.c

    Am 12.11.2026 um 18:41 schrieb Ross Finlayson:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.
    Works magnitudes better in C++ with std::function<> and generic
    function objects. F.e. when using std::find_if, std::sort etc.
    C sucks.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Nov 12 20:39:21 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    Ross Finlayson pisze:
    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    A usual account for example might recount component frameworks,
    like COM or XPCOM for example, about the concepts of components,
    vis-a-vis, modularity and composability, and, satisfaction of
    dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
    then about adapters to dependencies, or as for resources, that
    it's a bunch of makefiles with various accounts of conditional includes
    and build targets about static and dynamic linking and the toolchain,
    with regards to test-harness and runtime-framework and about
    metaprogramming when making code generation and boilerplate and so on.


    Defining an interface or layer is often enough about groups of functions
    associated with context-structs to make for lifecycles
    of what result alike the pure virtual or abstract or interfaces
    in reference to languages like C++, about families of functions
    according to the types of their signatures, then as with regards
    to componentry rather generally in value-types and interface-types
    like "variant" and "queryInterface()", about components that implement
    multiple interfaces vis-a-vis mostly about "constructing the
    object-graph" what makes for separation-of-concerns and composability,
    is mostly about modularity and composability.

    Then considerations of modularity as for library design affect to
    reflect on how to indicate responsibilities of ownership in resources,
    for example to hide contract & behavior of resources acquire/release.

    What I'm figuring is that basically there is a flat name-space of
    functions, there are .h and .c files (and may include "portable
    assembler"), and there is the compiler-toolchain, and make or
    build-scripts. Since there are only functions then dependencies their
    references would basically live in structs (in structs, in structs, ...,
    of function pointers), much like languages with classes and their
    instances objects and subclassing overriding behavior keeping in
    contract, about how to define "runtime-module" vis-a-vis "source module"
    (.o files after compilation-units), about conditional-includes
    and conditional-builds vis-a-vis name-mangling or the conventions of
    symbols.

    What, whither, when, how?


    this is not a large group and stating such soecific and wide question
    you minimalise the chance of answers to it to nearly zero

    you can enentually "answer to yourself" (as some say i do? well if i
    state question and some cant answer it after some time i myself may
    answer it) - though im usually not answering my own questions
    (sometimes) but simply "adding" more thoughts to prewious ones
    (which is qute good coz articles splitted on more parts ere better)


    overally people seem to ba rather weak in answering some more 'meta'
    questions (which is not strightforward as in the net (articles etc) i sometimes see lile people would be interested in meta topic to,
    but on c.l.c meta questions are rarely answered)

    if they will do i mayself would ask:

    have you noticed that mess rises in your code/projects ?
    what you do with that

    for exampel in my rasterizer/3d shooter prototype i read
    keys - it comes from wndproc key handler but as code grows larger
    damn i got not in memory where given key ich checked
    (as its handy and logical to check it close to its functionality,
    sometimes it is in general window handling, sometimes its in
    hud block, sometimes its in the scene root area sometimes its
    in the loop of objests

    good luck to finding it

    and that is how mess grows

    (its maybe not even mess - its maybe things dont fit in my memory
    so i must load it, and damn its slow
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Thu Nov 12 20:55:24 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    fir pisze:
    Ross Finlayson pisze:
    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control >>> and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    A usual account for example might recount component frameworks,
    like COM or XPCOM for example, about the concepts of components,
    vis-a-vis, modularity and composability, and, satisfaction of
    dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
    then about adapters to dependencies, or as for resources, that
    it's a bunch of makefiles with various accounts of conditional includes
    and build targets about static and dynamic linking and the toolchain,
    with regards to test-harness and runtime-framework and about
    metaprogramming when making code generation and boilerplate and so on.


    Defining an interface or layer is often enough about groups of functions >>> associated with context-structs to make for lifecycles
    of what result alike the pure virtual or abstract or interfaces
    in reference to languages like C++, about families of functions
    according to the types of their signatures, then as with regards
    to componentry rather generally in value-types and interface-types
    like "variant" and "queryInterface()", about components that implement
    multiple interfaces vis-a-vis mostly about "constructing the
    object-graph" what makes for separation-of-concerns and composability,
    is mostly about modularity and composability.

    Then considerations of modularity as for library design affect to
    reflect on how to indicate responsibilities of ownership in resources,
    for example to hide contract & behavior of resources acquire/release.

    What I'm figuring is that basically there is a flat name-space of
    functions, there are .h and .c files (and may include "portable
    assembler"), and there is the compiler-toolchain, and make or
    build-scripts. Since there are only functions then dependencies their
    references would basically live in structs (in structs, in structs, ..., >>> of function pointers), much like languages with classes and their
    instances objects and subclassing overriding behavior keeping in
    contract, about how to define "runtime-module" vis-a-vis "source module" >>> (.o files after compilation-units), about conditional-includes
    and conditional-builds vis-a-vis name-mangling or the conventions of
    symbols.

    What, whither, when, how?


    this is not a large group and stating such soecific and wide question
    you minimalise the chance of answers to it to nearly zero

    you can enentually "answer to yourself" (as some say i do? well if i
    state question and some cant answer it after some time i myself may
    answer it) - though im usually not answering my own questions
    (sometimes) but simply "adding" more thoughts to prewious ones
    (which is qute good coz articles splitted on more parts ere better)


    overally people seem to ba rather weak in answering some more 'meta' questions (which is not strightforward as in the net (articles etc) i sometimes see lile people would be interested in meta topic to,
    but on c.l.c meta questions are rarely answered)

    if they will do i mayself would ask:

    have you noticed that mess rises in your code/projects ?
    what you do with that

    for exampel in my rasterizer/3d shooter prototype i read
    keys - it comes from wndproc key handler but as code grows larger
    damn i got not in memory where given key ich checked
    (as its handy and logical to check it close to its functionality,
    sometimes it is in general window handling, sometimes its in
    hud block, sometimes its in the scene root area sometimes its
    in the loop of objests

    good luck to finding it

    and that is how mess grows

    (its maybe not even mess - its maybe things dont fit in my memory
    so i must load it, and damn its slow

    note i once emphasized what i call "code jumping"

    the fact that in larger projest and with some specific codes
    to write something you must travel thru code (mostly up and down or
    jum to anothe files ) now i could extend it to this mehanism of
    "memory loading" (not only you need to jump but you must memorize where
    is what) (yawn..and thsi damn slowing)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lew Pitcher@lew.pitcher@digitalfreehold.ca to comp.lang.c on Thu Nov 12 20:11:01 2026
    From Newsgroup: comp.lang.c

    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?
    --
    Lew Pitcher
    "In Skills We Trust"
    Not LLM output - I'm just like this.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c on Thu Nov 12 12:15:45 2026
    From Newsgroup: comp.lang.c

    On 11/12/2026 11:38 AM, Bonita Montero wrote:
    Am 12.11.2026 um 18:41 schrieb Ross Finlayson:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.
    Works magnitudes better in C++ with std::function<> and generic
    function objects. F.e. when using std::find_if, std::sort etc.
    C sucks.


    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Richard Harnden@richard.nospam@gmail.invalid to comp.lang.c on Thu Nov 12 20:55:40 2026
    From Newsgroup: comp.lang.c

    On 12/11/2026 20:11, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?


    Or get an AI do to your homework?

    Be careful to remove the white-on-white-very-small-font gotcha your
    professor doubtlessly put in.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Thu Nov 12 13:15:25 2026
    From Newsgroup: comp.lang.c

    On 11/12/2026 12:11 PM, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?


    Not at all, meaning, no offense taken.

    How about "writing testable code", what are common frameworks
    or best practices for "writing testable code" in C.

    I'd suggest abstraction and layers and modularity and composability,
    and having an inversion-of-control/dependency-injection approach,
    a convention moreso than a framework, which pretty much means wrapping
    all the standard functions, then about for example having an include
    where those are wrapper functions to stub and mock, and another include
    where those are macros, or, perhaps, using includes, to point the
    include directory for the standard library, into instead what makes
    for stubbable/mockable calls to standard library and system functions,
    or just leaving the headers alone and linking to modules that aren't
    the standard libraries, this being an example of something like
    "can't mock strftime", or, for an example.

    Then, about the modularity, and pointers (to pointers to pointers
    to pointers, ...) to functions, then seems about conventions of
    types for typeof and the like about that like anybody else I rely
    on the compiler to fail with -Wall and failing on warnings to
    catch type errors, ..., has that I want to program to interfaces
    and then have objects composable, ..., about using conditions of
    the build, to, basically make for test-time targets and run-time
    targets, with actually testing the code that goes into the build.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Thu Nov 12 13:44:15 2026
    From Newsgroup: comp.lang.c

    On 11/12/2026 12:55 PM, Richard Harnden wrote:
    On 12/11/2026 20:11, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control >>> and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?


    Or get an AI do to your homework?

    Be careful to remove the white-on-white-very-small-font gotcha your
    professor doubtlessly put in.




    When I use "A.I." it's framed as a dialogue and I just copy the
    transcripts directly, with the attributions.

    I.e., I've never submitted anything to Usenet written by a bot
    on my behalf.


    I'm not sure whether I'd call it "distance learning", or,
    "distance learning", say, ....




    Like say for example I'm looking at something like this that I tapped
    up this morning, and I want to figure out then how to make it so that
    the guts of the workers have a nice real quality of covering all the
    bases of covering all the cases, when for example according to the C
    host as it were or POSIX there's signals and traps to be figured out
    in accounts of "asynchronous concurrency".






    Outline of "I/O-handle-bound process model"

    The "I/O-handle-bound process model", is an account of a process group
    in a process tree,
    that works up to the bounds of 1024 many file-descriptors that a
    pselect() call can poll,
    with up to 1000-many file-descriptors in up to 1000-many worker
    processes, for up to
    1,000,000-many open connections.

    The "1000-many" is basically derived from FD_SETSIZE having a limit of
    1024,
    and that numbered file-descriptors that can participate in non-blocking I/O with pselect() notification of readiness, must be less than FD_SETSIZE
    their value.

    The basic idea is that there's a main or master process, that being also
    the process group leader,
    that has a "process-protocol" convention, that the master/leader, has
    domain sockets
    to its child processes, with up to 1000-many worker processes, then
    other processes
    as the listener, which accepts connections, and a logger and a metrics
    process.

    The listener is its own process that does accept and management (figured
    IP address listing and perhaps a tiny bit of TLS business). It's figured
    that it's
    an Internet protocol server, and "connection-oriented", or as mostly
    about TCP/IP,
    and furthermore "association-oriented", about SCTP, then about UDP or
    datagram
    "protocols", the listener demultiplexes the packets as "connections" to
    the workers.

    The file-descriptors in a process are numbered, non-negative integers.

    The file-descriptors 0, 1, 2 are ubiqitously stdin, stdout, stderr,
    "standard input-output-error".

    The file-descriptor 3 is reserved as it may be a convention for passing
    open connections to created processes.

    The file-descriptors 4, 5, 6 are reserved as "stdlog, stdmet, stddmp", "logging-metrics-dump outputs".

    The file-descriptors 21-1020 are reserved for "1000-many connections".

    The leader uses the "1000-many connections" for domain sockets to its "1000-many workers".

    Each follower (listener, worker, ...) has a reserved file-descriptor
    (11) to connect with the leader.

    The leader uses file-descriptor 11 to connect to the listener.
    The leader uses file-descriptor 12 to connect to an optional console.
    The leader uses file-descriptor 13 to connect to an optional logger.
    The leader uses file-descriptor 14 to connect to an optional metrics.

    launcher

    leader

    logger
    metrics
    console

    listener
    worker

    The model of operation describes how a process is created, according to
    fork and execve.

    The file-descriptors 0-10 are "standard", about stdin/stdout/stderr and
    these
    named stdlog/stdmet/stddmp. Usually stdin is un-read, or set to /dev/null. Usually stdout and stderr are inherited (by all child processes) from
    leader.

    The stdlog and stdmet and stddmp are inherited from leader. A usual idea is that these as file-handles may be passed to the leader for example to
    the shell,
    or that usually according to options, the first child processes of the
    leader are
    the logger and metrics, with the logger and metrics receiving all the
    messages
    on those handles, then the leader and all other processes sharing those handles,
    and all writing the logs and metrics to those same handles. Then, the
    dumper
    is an abstract output stream, outside of logging and metrics and
    standard I/O.

    The file-descriptors 11-20 are in the "process-protocol".

    The file-descriptors 21-1020 of the leader are in the "process-protocol".
    The file-descriptors 21-1020 of the listener are in the "process-protocol".
    The file-descriptors 21-1020 of the workers are in the
    "application-protocol".

    The file-descriptor 3 in the listener is the listening socket.
    The file-descriptor 3 may be passed to the leader to be passed to the
    listener,
    the listening socket.

    leader:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> logger
    12 <-> metrics
    13 <-> listener
    14 <-> console
    21-1020 <-> workers

    logger:
    4 <- stdlog
    6 <- stddmp
    11 <-> logger (leader)
    12 <-> metrics

    metrics:
    5 <- stdmet
    11 <-> logger
    12 <-> metrics (leader)


    listener:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> logger
    12 <-> metrics
    13 <-> listener (leader)
    14-20 <-> listening socket(s)
    21-1020 <-> workers

    worker:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> leader
    13 <-> listener
    21-1020 -> connections (front-end and back-end)

    Each of these has their own "main()" source code and executable,
    with that each is created by leader with fork() then setting the handles respectively, then execve() thus that the child processes start with
    their open handles in the process-protocol (11-20) and stdio (0-10)
    already opened and directed.

    Then, the process-protocol is according to use-cases, as driven by
    events, about that the domain-sockets that are under the handles
    of the process-protocol, make for passing data, and also live handles,
    as are the connections.


    The main use-case is that the listener is bound to a listening socket,
    as connections are accepted with connection-management happening
    in the listener, listener passes the connection to leader, which finds or create a worker, and passes the connection to worker, which then
    proceeds to service the connection according to the application-protocol.

    listener: accepts connection

    listener -> leader: connection-accepted !
    leader -> worker: connection-ready ?
    worker -> leader: connection-ready !
    leader -> listener: pass-ready !
    listener -> leader: connection-pass !
    leader -> worker: connection-pass !

    When a connection is closed, according to the application-protocol
    or if the connection drops or is severed, then worker advises leader,
    then leader advises listener.

    worker -> leader: connection-closed
    leader -> listener: connection-closed

    Then, when there are process-level events, the leader makes
    commands to the workers, about graceful exit.

    leader -> worker: drain connections
    leader -> worker: close connections
    leader -> worker: exit

    Since connections and their attachments & associations
    may be short-lived or long-lived, and the goal is that
    there only needs be as many workers as fulfill servicing
    the connections, then is that there's a process-protocol
    about migrating associations (and their connections)
    among workers, usually from "sparse" workers to "dense"
    workers, where sparse means "not-very-full" and dense
    means "not-very-empty", or from "short-lived" workers
    to "long-lived" workers when connections are long-lived,
    that "association migration" is in the process-protocol.

    leader -> worker: emigrate-association
    worker -> leader: migrate-association
    leader -> worker: immigrate-association


    The threading model in the process model

    The basic idea of the threading model is that workers
    are multi-threaded, the leader is single-threaded, and
    that the threads "park" when there is no activity,
    yet that the workers have one "sweeper" thread
    to account for time-outs, then that as the workers
    close their connections, they exit, so that under no
    traffic, there is no activity, with all processes "parked".

    The idea of "parking" is blocking on the inputs to the
    protocols, or the event-driven pumps in the workers.

    The threads basically block in pselect() waiting for
    ready reading, writing, or other events, or, waiting
    on a queue item, pop().

    The leader parks in pselect() on 11-1024, the process-protocol.

    The listener parks in pselect() about
    accept() and pselect() on the listening socket and
    the process-protocol sockets.

    The worker has four or more threads.

    reader-thread: parks in pselect() with read-interest
    executor-thread: parks in pop() of application-protocol tasks
    writer-thread: parks in pop() of application-protocol responses, then
    blocks in pselect() while writing, then parks
    sweeper-thread: according to time/alarm, runs on a frequency eg 500 milliseconds, 5 seconds, 5 minutes

    When the worker is empty, after its connections close, it exits.

    The logger and metrics park in pselect() on the read-side of stdlog/stdmet/stddmp.

    Thusly, at idle, with no connections, the entire process-group is
    "parked" (0% CPU, "acquiescent").







    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.c on Fri Nov 13 00:26:16 2026
    From Newsgroup: comp.lang.c

    On 2026-11-12 22:15, Ross Finlayson wrote:
    On 11/12/2026 12:11 PM, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control >>> and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?

    Not at all, meaning, no offense taken.

    Your original post and its intention had been also to me quite
    unclear. Here, now, I seem to understand at what you are aiming.

    (Disclaimer: my comments are just based on personal experience
    in our software developing practice from the 1990's and not some
    general accepted opinion or habits.)

    How about "writing testable code", what are common frameworks
    or best practices for "writing testable code" in C.

    Our approach was not to "write testable code" by _adapting_ to
    some existing framework. While we had standards and practices how
    to design software the _tests followed our software_ (not v.v.).
    One exception here was that including dedicated trace records in
    our code (that could be activated specifically WRT a module and
    in granularity) helped for the test evaluation and regressions.

    Then we have to differentiate what tests you have in mind here;
    there's various types of tests which require their own principles.
    For example; Unit Tests (in our [C++] context mainly classes, in
    "C" probably functions or a set of related functions) required
    functions that own little test programs would call to verify all
    the relevant conditions. We haven't used frameworks that created
    the tests but wrote our own dedicated test-functions along with the
    application functions. For our Component Tests (where components
    were in our case software pieces that constitute runtime processes
    with a well-defined interface) we wrote stubs that could challenge
    the components on the interface levels. Such stubs could operate
    some predefined procedures with well-defined input, or arbitrary
    data, or be an operator-triggered manual interaction, depending on
    the type of the component. Storing all the test input and output
    results made regression tests possible. For the Integration Tests I
    don't recall the procedures (it was done in a dedicated integration
    test group); but they defined and checked the system configuration,
    the interoperability (I think!) mostly manually. Malfunctions were
    reported back to development accompanied by protocols, traces, and
    actual data. The System Tests were checked against the specification
    documents, and the Acceptance Tests against the requirements specs,
    sometimes accompanied by the customers. One aspect yet not listed
    was the test of the GUIs; beside manual tests we used tools to do
    all that "mouse shoving and clicking". But given that the functional
    tests already happened on the automatable interface level in former
    stages that was effectively just to check the "UI ergonomy" ("UX")
    factors. And, finally, we had our own hierarchical regression test
    framework to run and document the tests on each abstraction stage.
    (Eventually there were also external third-party tools existing but
    back then we wrote (had to write) our own regression test framework
    that fulfilled our demands.)


    I'd suggest abstraction and layers and modularity and composability,

    Yes, those are principles that support the mentioned QA processes.

    and having an inversion-of-control/dependency-injection approach,

    (See my comment about "tests follow code (not v.v.)". - Opinions may
    differ.)

    a convention moreso than a framework, which pretty much means wrapping
    all the standard functions, then about for example having an include
    where those are wrapper functions to stub and mock, and another include
    where those are macros, or, perhaps, using includes, to point the
    include directory for the standard library, into instead what makes
    for stubbable/mockable calls to standard library and system functions,
    or just leaving the headers alone and linking to modules that aren't
    the standard libraries, this being an example of something like
    "can't mock strftime", or, for an example.

    Just a comment on one aspect here; yes, you have to organize your
    software and tests. Key principles are the modularity, hierarchical organization, being able to automate processes, and organize all in
    some consistent way. In case your company is certified (or wants to
    get certified) make sure your processes are documented and that you
    can reproduce your quality processes and the results.


    Then, about the modularity, and pointers (to pointers to pointers
    to pointers, ...) to functions, then seems about conventions of
    types for typeof and the like about that like anybody else I rely
    on the compiler to fail with -Wall and failing on warnings to
    catch type errors, ..., has that I want to program to interfaces
    and then have objects composable, ..., about using conditions of
    the build, to, basically make for test-time targets and run-time
    targets, with actually testing the code that goes into the build.

    It's not clear to me what you want to say here but it sounds that
    you want very specific ("micro-management") advice on a low level?
    (If so, I can't and don't want to comment here.)

    (All above from memories and off the top of my head. Hope there's
    something useful for your purpose.)

    Janis

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Thu Nov 12 17:22:00 2026
    From Newsgroup: comp.lang.c

    On 11/12/2026 03:26 PM, Janis Papanagnou wrote:
    On 2026-11-12 22:15, Ross Finlayson wrote:
    On 11/12/2026 12:11 PM, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of
    inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes >>>> and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?

    Not at all, meaning, no offense taken.

    Your original post and its intention had been also to me quite
    unclear. Here, now, I seem to understand at what you are aiming.

    (Disclaimer: my comments are just based on personal experience
    in our software developing practice from the 1990's and not some
    general accepted opinion or habits.)

    How about "writing testable code", what are common frameworks
    or best practices for "writing testable code" in C.

    Our approach was not to "write testable code" by _adapting_ to
    some existing framework. While we had standards and practices how
    to design software the _tests followed our software_ (not v.v.).
    One exception here was that including dedicated trace records in
    our code (that could be activated specifically WRT a module and
    in granularity) helped for the test evaluation and regressions.

    Then we have to differentiate what tests you have in mind here;
    there's various types of tests which require their own principles.
    For example; Unit Tests (in our [C++] context mainly classes, in
    "C" probably functions or a set of related functions) required
    functions that own little test programs would call to verify all
    the relevant conditions. We haven't used frameworks that created
    the tests but wrote our own dedicated test-functions along with the application functions. For our Component Tests (where components
    were in our case software pieces that constitute runtime processes
    with a well-defined interface) we wrote stubs that could challenge
    the components on the interface levels. Such stubs could operate
    some predefined procedures with well-defined input, or arbitrary
    data, or be an operator-triggered manual interaction, depending on
    the type of the component. Storing all the test input and output
    results made regression tests possible. For the Integration Tests I
    don't recall the procedures (it was done in a dedicated integration
    test group); but they defined and checked the system configuration,
    the interoperability (I think!) mostly manually. Malfunctions were
    reported back to development accompanied by protocols, traces, and
    actual data. The System Tests were checked against the specification documents, and the Acceptance Tests against the requirements specs,
    sometimes accompanied by the customers. One aspect yet not listed
    was the test of the GUIs; beside manual tests we used tools to do
    all that "mouse shoving and clicking". But given that the functional
    tests already happened on the automatable interface level in former
    stages that was effectively just to check the "UI ergonomy" ("UX")
    factors. And, finally, we had our own hierarchical regression test
    framework to run and document the tests on each abstraction stage. (Eventually there were also external third-party tools existing but
    back then we wrote (had to write) our own regression test framework
    that fulfilled our demands.)


    I'd suggest abstraction and layers and modularity and composability,

    Yes, those are principles that support the mentioned QA processes.

    and having an inversion-of-control/dependency-injection approach,

    (See my comment about "tests follow code (not v.v.)". - Opinions may
    differ.)

    a convention moreso than a framework, which pretty much means wrapping
    all the standard functions, then about for example having an include
    where those are wrapper functions to stub and mock, and another include
    where those are macros, or, perhaps, using includes, to point the
    include directory for the standard library, into instead what makes
    for stubbable/mockable calls to standard library and system functions,
    or just leaving the headers alone and linking to modules that aren't
    the standard libraries, this being an example of something like
    "can't mock strftime", or, for an example.

    Just a comment on one aspect here; yes, you have to organize your
    software and tests. Key principles are the modularity, hierarchical organization, being able to automate processes, and organize all in
    some consistent way. In case your company is certified (or wants to
    get certified) make sure your processes are documented and that you
    can reproduce your quality processes and the results.


    Then, about the modularity, and pointers (to pointers to pointers
    to pointers, ...) to functions, then seems about conventions of
    types for typeof and the like about that like anybody else I rely
    on the compiler to fail with -Wall and failing on warnings to
    catch type errors, ..., has that I want to program to interfaces
    and then have objects composable, ..., about using conditions of
    the build, to, basically make for test-time targets and run-time
    targets, with actually testing the code that goes into the build.

    It's not clear to me what you want to say here but it sounds that
    you want very specific ("micro-management") advice on a low level?
    (If so, I can't and don't want to comment here.)

    (All above from memories and off the top of my head. Hope there's
    something useful for your purpose.)

    Janis


    Thanks for writing.

    Usually enough these days with alike "CI/CD", ..., or the latest
    buzzwords of 2018, there's "build & test & scan & deploy", usually
    enough that "build & test & scan" is usually enough for "the artifacts",
    the build artifacts and the test artifacts and so on.
    When "automating the pipeline" and these kinds of things, it's not
    un-usual that the test-suite whatever it may be, has that there are
    some XML formats that are readily ingested and fungible to the
    framework, vis-a-vis, usually enough it's that "./test returns
    either EXIT_SUCCESS or EXIT_FAILURE and that's our predicate
    and build-step and action and work-flow too in our Git Hub/Lab".

    So, for whatever results "test: pass/fail", may make for that
    there are fungible report formats that might be useful downstream,
    for example "automated code-reviews that show what broke where, when".


    So, agreeably, basically it's figured a build step.

    Then, it sounds like we're both familiar with settings where
    the notions of "unit tests, module tests, integration tests,
    end-to-end tests, smoke-tests, sanity-tests, activation-tests",
    representing ye olde "acceptance criteria" usually though often
    practically "broken" or "not broken" the build, then about the
    mania for "branch and line coverage, with whatever possible stubs
    and mocks make the instrumented code covered", that's agreeable
    and usual.


    Then, about testing the black-box or white-box, say, here it's
    considered that both are apropos, like for example "health checks
    and internal and external health checks". Then, here's a sort of
    example, if you're familiar with something like "React and Angular
    and these sorts of front-ends". So, often there are things like
    "jest tests then Web Driver and somebody walked through the work-flows
    and it re-plays them and it only takes 8 GiB and forty-five minutes".
    Well, that's with the expectation that "it has to run in the browser",
    yet, at one point it was reasonably simple, for example for "React",
    about 16 or 17 I suppose, to just implement "the algorithm" and just
    include a file that basically modeled the runtime, then it can test
    all the workflows programmatically, as a sort of example. That
    got less possible when "effects" were added, yet otherwise it
    was possible to have it "test" a lot faster.

    It's agreeable that it may be impossible to model the system in
    software when it's involved a system, and, black-box and integration
    tests ("don't forget regression!"), then it may also be so that
    a sort of mini-model of the surface of the library and framework
    that's used, can be much, much reduced, from all the library. For
    example, say "C" has 100's standard functions and "POSIX" hundreds
    more. Well, often I have here programs that effectively use dozens, or
    less. Then, the model of the machine is plenty involved, like "the
    operating system" and "the process model" and "handles" and "sockets"
    and "signals" all that, it may make sense though to make "mini-models", basically emulating "the surface", i.e., "the test-able surface".


    Then, about C, which may be less structured for abstraction as
    modeling the surface of the run-time, has that many use-cases
    only use a tiny, tiny fraction of the run-time, about figuring
    that as modular and composable, and with basically zero available
    tooling, this kind of thing.


    Abstraction introduces complexity, and indirection, with the
    usual idea that it compiles to what's the "zero-cost abstraction",
    i.e. the abstraction gets compiled away, here basically about
    replacing the implementations of the standard and library functions
    with a, "mini-model", of operation, then to sort of build that
    and make it re-usable, then to be able to build unit-tests off
    that (and, you know, unit tests of those, ..., peeling-the-onion),
    that "verified" and "certified" are like "validated" and only
    "not falsified" and "not in-verified" and "not in-certified"
    and "not in-validated", ..., then for "module tests" after those
    unit test, then after the real build artifacts built against the
    real dependencies, integration and so on.





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.lang.c on Fri Nov 13 05:28:28 2026
    From Newsgroup: comp.lang.c

    In article <11d56gl$3ud5q$1@dont-email.me>,
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?

    It is obvious AI (*) slop. Can we just ignore this and move on?

    (*) Oops. Sorry. I mean, "SI".

    Oh, and can you believe that the SI industry is all in a tizzy and could
    very well crash and wipe out trillions in paper wealth, just because of
    some guy having extramarital sex? I thought we left that sort of thing
    behind in the 90s (the last time we got all in a tizzy about this sort of
    thing being Bill Clinton...)
    --
    "You can safely assume that you have created God in your own image when
    it turns out that God hates all the same people you do." -- Anne Lamott

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Paul@nospam@needed.invalid to comp.lang.c on Fri Nov 13 04:09:55 2026
    From Newsgroup: comp.lang.c

    On Fri, 11/13/2026 12:28 AM, Kenny McCormack wrote:
    In article <11d56gl$3ud5q$1@dont-email.me>,
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control >>> and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?

    It is obvious AI (*) slop. Can we just ignore this and move on?

    (*) Oops. Sorry. I mean, "SI".

    Oh, and can you believe that the SI industry is all in a tizzy and could
    very well crash and wipe out trillions in paper wealth, just because of
    some guy having extramarital sex? I thought we left that sort of thing behind in the 90s (the last time we got all in a tizzy about this sort of thing being Bill Clinton...)


    I think the issue is violation of export law.

    You can see how they handle "pure diddling", in the first incident
    (swept under the rug). But this is different, because of the export law thing.

    If he hadn't helped the chick move 7.5 billion worth of equipment,
    the metrics would be different.

    Paul
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Fri Nov 13 10:18:40 2026
    From Newsgroup: comp.lang.c

    Ross Finlayson pisze:
    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes
    and various build-targets, probably mostly about function pointers.

    A usual account for example might recount component frameworks,
    like COM or XPCOM for example, about the concepts of components,
    vis-a-vis, modularity and composability, and, satisfaction of
    dependencies, vis-a-vis IPC and RPC, abstraction layers often enough,
    then about adapters to dependencies, or as for resources, that
    it's a bunch of makefiles with various accounts of conditional includes
    and build targets about static and dynamic linking and the toolchain,
    with regards to test-harness and runtime-framework and about
    metaprogramming when making code generation and boilerplate and so on.


    Defining an interface or layer is often enough about groups of functions associated with context-structs to make for lifecycles
    of what result alike the pure virtual or abstract or interfaces
    in reference to languages like C++, about families of functions
    according to the types of their signatures, then as with regards
    to componentry rather generally in value-types and interface-types
    like "variant" and "queryInterface()", about components that implement multiple interfaces vis-a-vis mostly about "constructing the
    object-graph" what makes for separation-of-concerns and composability,
    is mostly about modularity and composability.

    Then considerations of modularity as for library design affect to
    reflect on how to indicate responsibilities of ownership in resources,
    for example to hide contract & behavior of resources acquire/release.

    What I'm figuring is that basically there is a flat name-space of
    functions, there are .h and .c files (and may include "portable
    assembler"), and there is the compiler-toolchain, and make or
    build-scripts. Since there are only functions then dependencies their references would basically live in structs (in structs, in structs, ...,
    of function pointers), much like languages with classes and their
    instances objects and subclassing overriding behavior keeping in
    contract, about how to define "runtime-module" vis-a-vis "source module"
    (.o files after compilation-units), about conditional-includes
    and conditional-builds vis-a-vis name-mangling or the conventions of
    symbols.

    What, whither, when, how?


    overally yours pyramide of this soft youre talkin about is build from
    small blocks/pieces (i dont mean pieces of code but some design pices
    (like alos this you mentioned dependency injection, inversion of
    controll and more)

    if you want answers ask some specific things on those pieces..asking
    on whole pyramid may be stupid as this stack of youre is probably quite specyfic - i would guess you have so many bad design decision stacked
    its in some wayj hopeless ;c (thoug hopeless is obviously an exagerration)

    i dont stack the bulshit and even in my case probblems appear when
    program is getting bigger

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c on Fri Nov 13 13:25:29 2026
    From Newsgroup: comp.lang.c

    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 05:07:52 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke functions with data and assert(expected == actual)", that for example of
    "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and
    the usual object files in the usual object formats on the usual
    runtimes.



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bartc@bc@freeuk.com to comp.lang.c on Fri Nov 13 13:27:55 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke functions with data and assert(expected == actual)", that for example of
    "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and
    the usual object files in the usual object formats on the usual
    runtimes.
    This is not homework. And it's not written in good faith, it is just gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs as
    Mr RF has done.

    You don't need to use a program to do it (although it would be most
    impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 05:50:15 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 05:27 AM, bartc wrote:
    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the
    bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing
    frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke
    functions with data and assert(expected == actual)", that for example of
    "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and
    the usual object files in the usual object formats on the usual
    runtimes.
    This is not homework. And it's not written in good faith, it is just gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs as
    Mr RF has done.

    You don't need to use a program to do it (although it would be most impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.


    You challenge my good faith, then to hell with you.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Richard Harnden@richard.nospam@gmail.invalid to comp.lang.c on Fri Nov 13 13:49:45 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke functions with data and assert(expected == actual)", that for example of
    "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and
    the usual object files in the usual object formats on the usual
    runtimes.




    The answer is 'yes'. Or maybe 'no'. I'm not sure.

    What was the question?

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 05:56:21 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 05:50 AM, Ross Finlayson wrote:
    On 11/13/2026 05:27 AM, bartc wrote:
    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me. >>>> Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the
    bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing
    frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke >>> functions with data and assert(expected == actual)", that for example of >>> "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and >>> the usual object files in the usual object formats on the usual
    runtimes.
    This is not homework. And it's not written in good faith, it is just
    gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs as
    Mr RF has done.

    You don't need to use a program to do it (although it would be most
    impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.


    You challenge my good faith, then to hell with you.




    Basically free humans should make a nice new clean-room take on
    open source with stable interfaces, before the would-be bot-ocracy
    re-writes it as a warren and maze of dark twisty passages all alike.

    It might be eaten by a grue, ....


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.c on Fri Nov 13 15:07:02 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 14:27, bartc wrote:

    This is not homework. And it's not written in good faith, it is just gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs as
    Mr RF has done.

    You don't need to use a program to do it (although it would be most impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.


    I don't think there is any bad-faith or trolling in Ross' posts - he
    seems simply incapable of writing comprehensibly. It is gobbledygook,
    but I don't see it as intentional.

    It looks like he is trying to ask something about how people test their
    C code, but I can't figure out anything more than that.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 06:24:30 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 05:49 AM, Richard Harnden wrote:
    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the
    bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing
    frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke
    functions with data and assert(expected == actual)", that for example of
    "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and
    the usual object files in the usual object formats on the usual
    runtimes.




    The answer is 'yes'. Or maybe 'no'. I'm not sure.

    What was the question?



    How to design and make conventions and opinions and idiom and discipline
    the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 06:29:08 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 06:24 AM, Ross Finlayson wrote:
    On 11/13/2026 05:49 AM, Richard Harnden wrote:
    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me. >>>> Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the
    bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing
    frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke >>> functions with data and assert(expected == actual)", that for example of >>> "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and >>> the usual object files in the usual object formats on the usual
    runtimes.




    The answer is 'yes'. Or maybe 'no'. I'm not sure.

    What was the question?



    How to design and make conventions and opinions and idiom and discipline
    the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"



    Object-oriented programming, data-oriented programming,
    aspect-oriented programming, table-oriented programming,
    pattern-oriented programming, ....

    Systems programming, ..., application programming, ...,
    core programming, distributed programming, ....

    Procedural, function, literate, intentional, ....

    Modules. (Blocks and Modules, Modules and Interfaces.)


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bartc@bc@freeuk.com to comp.lang.c on Fri Nov 13 16:01:24 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 14:07, David Brown wrote:
    On 13/11/2026 14:27, bartc wrote:

    This is not homework. And it's not written in good faith, it is just
    gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs as
    Mr RF has done.

    You don't need to use a program to do it (although it would be most
    impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.


    I don't think there is any bad-faith or trolling in Ross' posts - he
    seems simply incapable of writing comprehensibly.-a It is gobbledygook,
    but I don't see it as intentional.

    It looks like he is trying to ask something about how people test their
    C code, but I can't figure out anything more than that.


    How about this which was recently posted:

    RH:
    What was the question?


    RF:
    How to design and make conventions and opinions and idiom and discipline
    the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"

    It is just utterly meaningless. Still think this is written in good
    faith? RF is just having a laugh.



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Fri Nov 13 17:10:43 2026
    From Newsgroup: comp.lang.c

    Ross Finlayson pisze:
    On 11/13/2026 05:49 AM, Richard Harnden wrote:
    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me. >>>> Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the
    bus.)


    So, say I'm writing a usual sort of server with an idea that
    basically it's about "protocols", mostly, so, living in a world
    of the 7-layer OSI model, which is a pretty great abstraction and
    all the Internet protocols basically live in that world of definition,
    while though sometimes the network/transport then the
    application/presentation layers gets switched and crossed,
    point being there are systems with various accounts of moving parts
    and then is for testing in isolation the parts moving and also
    the moving of the parts.


    Then, lots of languages make great use of "reflection", which is
    an account of determining from the constructs their structure,
    which one may aver that that's what parser & compilers do already,
    and so if a C programmer needs reflection then if they're a real
    programmer or a real coder then they'd just make their own account
    of reflection and model the world in a model of the world, and
    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned
    into the language instead of libraries, or made standard, that
    since "run-time-type-identification" for example since something
    quite useful like "the variant data-type", sort of an "any: typed",
    that "reflection" and "introspection" are how most of the unit-testing
    frameworks make for inference about types then for conventions of
    signatures to make it easy the "test-fixtures", or otherwise the
    accounts of modularity and inversion-of-control and
    dependency-injection, then about something like C that it's "just invoke >>> functions with data and assert(expected == actual)", that for example of >>> "the many main()'s" just exec'ing those from the test process
    whether the tests exit(0) or exit(1), or rather as they die when
    assert evaluates false, for example as with regards when running
    under a debugger naturally just stopping there live in the debugger.


    So, among the goals of writing frameworks or tools or tests or
    systems, is that it works nicely with all the tools, according
    to usually enough just the totally common standards of the toolchain and >>> the usual object files in the usual object formats on the usual
    runtimes.




    The answer is 'yes'. Or maybe 'no'. I'm not sure.

    What was the question?



    How to design and make conventions and opinions and idiom and discipline
    the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"

    in c you use dlls

    its reusable, reliable, modular, as far as i know is to be wrapped in hl languages, its lean ad modulat and forunatly its not OOP shit, its also probably idiomatis its direct and its about zero cost

    objet orientation s trash - hovever you could do it by writing some
    things that return handles but imo if you use handles its probably bad
    design (i rarely used handles - though dont ask me how to ot use handles
    as i donr remember when i wrota a code it just usually dont need
    handles (or i use it minimal way, i mean if handle is assigned
    immedatelly to a global variable its less dangerous/confusing)



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.c on Fri Nov 13 17:54:23 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 17:01, bartc wrote:
    On 13/11/2026 14:07, David Brown wrote:
    On 13/11/2026 14:27, bartc wrote:

    This is not homework. And it's not written in good faith, it is just
    gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these buzzwords,
    and try to write a set of viable-looking but meaningless paragraphs
    as Mr RF has done.

    You don't need to use a program to do it (although it would be most
    impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful.


    I don't think there is any bad-faith or trolling in Ross' posts - he
    seems simply incapable of writing comprehensibly.-a It is gobbledygook,
    but I don't see it as intentional.

    It looks like he is trying to ask something about how people test
    their C code, but I can't figure out anything more than that.


    How about this which was recently posted:

    RH:
    What was the question?


    RF:
    How to design and make conventions and opinions and idiom and discipline the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"

    It is just utterly meaningless. Still think this is written in good
    faith? RF is just having a laugh.

    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups.
    I find it hard to believe that someone would spend so much time and
    effort for a joke.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Fri Nov 13 14:50:35 2026
    From Newsgroup: comp.lang.c

    On 11/13/2026 08:54 AM, David Brown wrote:
    On 13/11/2026 17:01, bartc wrote:
    On 13/11/2026 14:07, David Brown wrote:
    On 13/11/2026 14:27, bartc wrote:

    This is not homework. And it's not written in good faith, it is just
    gobbledygook.

    I'm surprised so many here can't see it.

    Here is an interesting challenge: take a list of all these
    buzzwords, and try to write a set of viable-looking but meaningless
    paragraphs as Mr RF has done.

    You don't need to use a program to do it (although it would be most
    impressive as a C exercise).

    You win when a human mistakes it for something profound and insightful. >>>>

    I don't think there is any bad-faith or trolling in Ross' posts - he
    seems simply incapable of writing comprehensibly. It is
    gobbledygook, but I don't see it as intentional.

    It looks like he is trying to ask something about how people test
    their C code, but I can't figure out anything more than that.


    How about this which was recently posted:

    RH:
    What was the question?


    RF:
    How to design and make conventions and opinions and idiom and
    discipline
    the inversion-of-control and dependency-injection
    for the modularity and composability, in C? How do?

    For example, "what is good style in C to be idiomatic and
    direct in C toward zero-cost-abstraction, while yet directly
    resulting clean modular composable object-orientation in
    higher-level languages to wrap and interoperate, with
    modular and composable, and re-usable, and reliable,
    components in C?"

    It is just utterly meaningless. Still think this is written in good
    faith? RF is just having a laugh.

    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups.
    I find it hard to believe that someone would spend so much time and
    effort for a joke.



    Hm.

    Yes, I've tapped 10,000's posts to Usenet with my own fat fingers.
    This includes basically research and a survey into "the Foundations
    of Mathematics", including a rather strong attack, then also I've
    been looking into physics for a while.

    I've written 100's KLOC's enterprise code, and generated tons more,
    at various outlets of "big tech", among my dozens logins.

    Also there are several hundred hours on my "YouTube" channel. All me.



    So, here's one. Say you got a server process for sockets of the connection-oriented or datagram-wise or association-oriented like
    TCP, UDP, or SCTP, and it manages the connecting and the sending and
    receiving about a million of those and is sort of fixed-size and
    stable in a usual runtime. So, how do you design the interface,
    about stuff like the state-machine of _protocols_, all about
    _protocols_, in the application-layer and above, say, for example
    the incremental-parsing and the state-machine of the protocol
    and sub-protocols and upgrade-protocols and the like, what sort
    of abstraction with suitable-defaults and reasonable-opinions
    makes for having any sort protocol as a composable library.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.lang.c on Sat Nov 14 08:09:17 2026
    From Newsgroup: comp.lang.c

    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups.
    I find it hard to believe that someone would spend so much time and
    effort for a joke.

    One word: fir.

    And, BTW, "joke" isn't quite the right word. It is more of thinking you
    are on a mission from God.
    --
    A 70 year old man who watches 6 hours of TV a day, plays a lot of golf
    and seems to always be in Florida is a retiree, not a president.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sat Nov 14 11:49:15 2026
    From Newsgroup: comp.lang.c

    Kenny McCormack pisze:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups.
    I find it hard to believe that someone would spend so much time and
    effort for a joke.

    One word: fir.

    And, BTW, "joke" isn't quite the right word. It is more of thinking you
    are on a mission from God.


    maybe stap talkin bulshit kenny.. this pure fact ypou dont understand
    what im saying it dont means im on a mission from god (Crom is only a
    helper)

    im just doing some science on c syntax space, thats all
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From bartc@bc@freeuk.com to comp.lang.c on Sat Nov 14 12:14:31 2026
    From Newsgroup: comp.lang.c

    On 14/11/2026 08:09, Kenny McCormack wrote:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups.
    I find it hard to believe that someone would spend so much time and
    effort for a joke.

    One word: fir.

    How about Bill Cunningham?


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.lang.c on Sat Nov 14 13:19:31 2026
    From Newsgroup: comp.lang.c

    In article <11d9jb7$1tt0p$1@dont-email.me>, bartc <bc@freeuk.com> wrote:
    On 14/11/2026 08:09, Kenny McCormack wrote:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross
    has written posts in this style for many years in several Usenet groups. >>> I find it hard to believe that someone would spend so much time and
    effort for a joke.

    One word: fir.

    How about Bill Cunningham?



    Not sure I catch the reference, but I do vaguely remember that name being someone who used to post here.

    The thing is, though, when you get right down to it, nobody really knows
    why anyone posts here. I think each person who does does so for personal reasons that are in general not fully comprehensible by anyone else.

    Take the classic question: Why does Kenny McCormack post here, when all he
    does is troll? Well, he does it because it is fun and it amuses him.

    But I often ask: Why does KT post here? Since he obviously knows
    everything there is to know about C, why bother posting here? It's not
    like he is ever going to learn anything (since he already knows
    everything). Now, he will say, it is because he wants to help people.
    Well, this motive is already suspect (usually people who say they want to
    help people have some other motive, sometimes in addition to a genuine
    desire to help, but sometimes as the only motive), and, secondly, given how much effort he puts into it, it is hard to believe that altruism is the
    only reason.

    And you could ask similar questions about just about everyone else who
    posts to Usenet (not just this group) ?

    And so it goes...
    --
    Shikata ga nai...
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sat Nov 14 14:33:41 2026
    From Newsgroup: comp.lang.c

    Kenny McCormack pisze:
    In article <11d9jb7$1tt0p$1@dont-email.me>, bartc <bc@freeuk.com> wrote:
    On 14/11/2026 08:09, Kenny McCormack wrote:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross >>>> has written posts in this style for many years in several Usenet groups. >>>> I find it hard to believe that someone would spend so much time and >>>> effort for a joke.

    One word: fir.

    How about Bill Cunningham?



    Not sure I catch the reference, but I do vaguely remember that name being someone who used to post here.

    The thing is, though, when you get right down to it, nobody really knows
    why anyone posts here. I think each person who does does so for personal reasons that are in general not fully comprehensible by anyone else.

    Take the classic question: Why does Kenny McCormack post here, when all he does is troll? Well, he does it because it is fun and it amuses him.

    But I often ask: Why does KT post here? Since he obviously knows
    everything there is to know about C, why bother posting here? It's not
    like he is ever going to learn anything (since he already knows
    everything). Now, he will say, it is because he wants to help people.
    Well, this motive is already suspect (usually people who say they want to help people have some other motive, sometimes in addition to a genuine
    desire to help, but sometimes as the only motive), and, secondly, given how much effort he puts into it, it is hard to believe that altruism is the
    only reason.

    And you could ask similar questions about just about everyone else who
    posts to Usenet (not just this group) ?

    And so it goes...


    i post here to increase my knowledge and understanding the c and "behind
    c" and im quite succesfull in it i would say (also note my plan is to
    code and thus write here till the end of the year, maybe enlonged to
    middle of januarry so later i may vanish for few months

    interesting in last years i get real long breaks on coding but this
    autumn thenx to ai it gave me a doze of fun again)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Sat Nov 14 08:17:12 2026
    From Newsgroup: comp.lang.c

    On 11/14/2026 05:19 AM, Kenny McCormack wrote:
    In article <11d9jb7$1tt0p$1@dont-email.me>, bartc <bc@freeuk.com> wrote:
    On 14/11/2026 08:09, Kenny McCormack wrote:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Brown <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly. And it is
    not so void of meaning and grammar that it is randomly generated. Ross >>>> has written posts in this style for many years in several Usenet groups. >>>> I find it hard to believe that someone would spend so much time and >>>> effort for a joke.

    One word: fir.

    How about Bill Cunningham?



    Not sure I catch the reference, but I do vaguely remember that name being someone who used to post here.

    The thing is, though, when you get right down to it, nobody really knows
    why anyone posts here. I think each person who does does so for personal reasons that are in general not fully comprehensible by anyone else.

    Take the classic question: Why does Kenny McCormack post here, when all he does is troll? Well, he does it because it is fun and it amuses him.

    But I often ask: Why does KT post here? Since he obviously knows
    everything there is to know about C, why bother posting here? It's not
    like he is ever going to learn anything (since he already knows
    everything). Now, he will say, it is because he wants to help people.
    Well, this motive is already suspect (usually people who say they want to help people have some other motive, sometimes in addition to a genuine
    desire to help, but sometimes as the only motive), and, secondly, given how much effort he puts into it, it is hard to believe that altruism is the
    only reason.

    And you could ask similar questions about just about everyone else who
    posts to Usenet (not just this group) ?

    And so it goes...



    Usenet is like a rather large bulletin-board system of the world,
    though I guess that's what "FIDO Net" is, federated bulletin-boards.
    Usenet has all the trappings the Internet, which it predates, i.e.
    pre-dates not pred-ates, where "predation" and "predating" are two
    different words, though, both I suppose gerunds, point being that Usenet
    has been around since before the Internet, and it has URL's and
    since every message ever posted is designed to have a unique ID,
    then also there are bibiographic citation standards about it,
    which might not mean much except that all the messages are distributed
    in the widely decentralized and available to any, in the public
    availability and not the public domain, as naturally authors maintain
    copyright of their postings they publish.


    Why people post to Usenet is for whatever reason they want
    and when they do is their own business, though it's rather
    explicitly not-for-commercial-purposes and it's not much
    for me to say how anti-spam works.

    Whether all gerunds end in "-ing" for example, there's a corner
    where once-upon-a-time people with strong opinions would weigh
    the question and merit the weights and politely and eruditely
    argue its alternatives, with great decorum and fine collegiality.

    ... Or flame all day, it's a free country.

    There are moderated groups, most dusty or defunct.


    Then, there are issues about that since the basically return-path
    is email, and email may be fakemail, and not all vectors into Usenet
    care, whether "Kenny McCormack", for example, inspired or mocks
    the character from "Spice Pork", who-made-who, has that it is or isn't
    so, then also that long before "A.I." was shored-up and silo'ed
    behind the more commercial accounts of "social media", there are
    tons bots among the trolls, usually with stolen identities from
    dupes on the Internet who'd never notice, yet of course that sort
    of practice is way more evident in the modern commercial accounts
    of "social media" with the "I.A.: instant audience" of simple
    bot-fan and bot-troll accounts of click-fraud and propagandist spew.


    Then, a key account of the Usenet is the co-operative aspect,
    and, "The Charter". Each Usenet group has a little charter,
    and used to be each one had a little "Frequently Asked Questions",
    or the culture, for others it's just a feed.


    Now if you'll excuse I'll go rake a leaf or wash a dish or something,
    or maybe organize my closet or or take a pick-axe to a road somewhere,
    yet, probably instead I might be further asking, or, telling, what
    sorts of accounts go into modular software in C.


    The basic idea for that is sort of an account of functions,
    callback-functions, and data, in the language, what's to result models
    of co-operation, about how to call various code _inside_ the runtime, vis-a-vis, various code calling _into_ the runtime, basically mirroring
    the concerns of library authors, of component authors, basically here introducing libraries vis-a-vis components, which is about as old of
    a way of looking at matters of modularity & composability as has always
    been.



    This message will have a permanent, unique ID, when it's published.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Sat Nov 14 09:05:46 2026
    From Newsgroup: comp.lang.c

    On 11/12/2026 01:44 PM, Ross Finlayson wrote:
    On 11/12/2026 12:55 PM, Richard Harnden wrote:
    On 12/11/2026 20:11, Lew Pitcher wrote:
    On Thu, 12 Nov 2026 09:41:04 -0800, Ross Finlayson wrote:

    Hello, dear C experts, I'm hoping you can tell me a story about
    modularity and composability, about the concerns of
    inversion-of-control
    and dependency-injection in C, basically about wiring
    test-time and run-time targets, for example about conditional-includes >>>> and various build-targets, probably mostly about function pointers.

    Pardon my impertinence, but this sounds like a homework problem to me.

    Could you rephrase your question without the academic wording?


    Or get an AI do to your homework?

    Be careful to remove the white-on-white-very-small-font gotcha your
    professor doubtlessly put in.




    When I use "A.I." it's framed as a dialogue and I just copy the
    transcripts directly, with the attributions.

    I.e., I've never submitted anything to Usenet written by a bot
    on my behalf.


    I'm not sure whether I'd call it "distance learning", or,
    "distance learning", say, ....




    Like say for example I'm looking at something like this that I tapped
    up this morning, and I want to figure out then how to make it so that
    the guts of the workers have a nice real quality of covering all the
    bases of covering all the cases, when for example according to the C
    host as it were or POSIX there's signals and traps to be figured out
    in accounts of "asynchronous concurrency".






    Outline of "I/O-handle-bound process model"

    The "I/O-handle-bound process model", is an account of a process group
    in a process tree,
    that works up to the bounds of 1024 many file-descriptors that a
    pselect() call can poll,
    with up to 1000-many file-descriptors in up to 1000-many worker
    processes, for up to
    1,000,000-many open connections.

    The "1000-many" is basically derived from FD_SETSIZE having a limit of
    1024,
    and that numbered file-descriptors that can participate in non-blocking I/O with pselect() notification of readiness, must be less than FD_SETSIZE
    their value.

    The basic idea is that there's a main or master process, that being also
    the process group leader,
    that has a "process-protocol" convention, that the master/leader, has
    domain sockets
    to its child processes, with up to 1000-many worker processes, then
    other processes
    as the listener, which accepts connections, and a logger and a metrics process.

    The listener is its own process that does accept and management (figured
    IP address listing and perhaps a tiny bit of TLS business). It's figured
    that it's
    an Internet protocol server, and "connection-oriented", or as mostly
    about TCP/IP,
    and furthermore "association-oriented", about SCTP, then about UDP or datagram
    "protocols", the listener demultiplexes the packets as "connections" to
    the workers.

    The file-descriptors in a process are numbered, non-negative integers.

    The file-descriptors 0, 1, 2 are ubiqitously stdin, stdout, stderr,
    "standard input-output-error".

    The file-descriptor 3 is reserved as it may be a convention for passing
    open connections to created processes.

    The file-descriptors 4, 5, 6 are reserved as "stdlog, stdmet, stddmp", "logging-metrics-dump outputs".

    The file-descriptors 21-1020 are reserved for "1000-many connections".

    The leader uses the "1000-many connections" for domain sockets to its "1000-many workers".

    Each follower (listener, worker, ...) has a reserved file-descriptor
    (11) to connect with the leader.

    The leader uses file-descriptor 11 to connect to the listener.
    The leader uses file-descriptor 12 to connect to an optional console.
    The leader uses file-descriptor 13 to connect to an optional logger.
    The leader uses file-descriptor 14 to connect to an optional metrics.

    launcher

    leader

    logger
    metrics
    console

    listener
    worker

    The model of operation describes how a process is created, according to
    fork and execve.

    The file-descriptors 0-10 are "standard", about stdin/stdout/stderr and
    these
    named stdlog/stdmet/stddmp. Usually stdin is un-read, or set to /dev/null. Usually stdout and stderr are inherited (by all child processes) from
    leader.

    The stdlog and stdmet and stddmp are inherited from leader. A usual idea is that these as file-handles may be passed to the leader for example to
    the shell,
    or that usually according to options, the first child processes of the
    leader are
    the logger and metrics, with the logger and metrics receiving all the messages
    on those handles, then the leader and all other processes sharing those handles,
    and all writing the logs and metrics to those same handles. Then, the
    dumper
    is an abstract output stream, outside of logging and metrics and
    standard I/O.

    The file-descriptors 11-20 are in the "process-protocol".

    The file-descriptors 21-1020 of the leader are in the "process-protocol".
    The file-descriptors 21-1020 of the listener are in the "process-protocol". The file-descriptors 21-1020 of the workers are in the "application-protocol".

    The file-descriptor 3 in the listener is the listening socket.
    The file-descriptor 3 may be passed to the leader to be passed to the listener,
    the listening socket.

    leader:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> logger
    12 <-> metrics
    13 <-> listener
    14 <-> console
    21-1020 <-> workers

    logger:
    4 <- stdlog
    6 <- stddmp
    11 <-> logger (leader)
    12 <-> metrics

    metrics:
    5 <- stdmet
    11 <-> logger
    12 <-> metrics (leader)


    listener:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> logger
    12 <-> metrics
    13 <-> listener (leader)
    14-20 <-> listening socket(s)
    21-1020 <-> workers

    worker:
    4 -> stdlog
    5 -> stdmet
    6 -> stddmp
    11 <-> leader
    13 <-> listener
    21-1020 -> connections (front-end and back-end)

    Each of these has their own "main()" source code and executable,
    with that each is created by leader with fork() then setting the handles respectively, then execve() thus that the child processes start with
    their open handles in the process-protocol (11-20) and stdio (0-10)
    already opened and directed.

    Then, the process-protocol is according to use-cases, as driven by
    events, about that the domain-sockets that are under the handles
    of the process-protocol, make for passing data, and also live handles,
    as are the connections.


    The main use-case is that the listener is bound to a listening socket,
    as connections are accepted with connection-management happening
    in the listener, listener passes the connection to leader, which finds or create a worker, and passes the connection to worker, which then
    proceeds to service the connection according to the application-protocol.

    listener: accepts connection

    listener -> leader: connection-accepted !
    leader -> worker: connection-ready ?
    worker -> leader: connection-ready !
    leader -> listener: pass-ready !
    listener -> leader: connection-pass !
    leader -> worker: connection-pass !

    When a connection is closed, according to the application-protocol
    or if the connection drops or is severed, then worker advises leader,
    then leader advises listener.

    worker -> leader: connection-closed
    leader -> listener: connection-closed

    Then, when there are process-level events, the leader makes
    commands to the workers, about graceful exit.

    leader -> worker: drain connections
    leader -> worker: close connections
    leader -> worker: exit

    Since connections and their attachments & associations
    may be short-lived or long-lived, and the goal is that
    there only needs be as many workers as fulfill servicing
    the connections, then is that there's a process-protocol
    about migrating associations (and their connections)
    among workers, usually from "sparse" workers to "dense"
    workers, where sparse means "not-very-full" and dense
    means "not-very-empty", or from "short-lived" workers
    to "long-lived" workers when connections are long-lived,
    that "association migration" is in the process-protocol.

    leader -> worker: emigrate-association
    worker -> leader: migrate-association
    leader -> worker: immigrate-association


    The threading model in the process model

    The basic idea of the threading model is that workers
    are multi-threaded, the leader is single-threaded, and
    that the threads "park" when there is no activity,
    yet that the workers have one "sweeper" thread
    to account for time-outs, then that as the workers
    close their connections, they exit, so that under no
    traffic, there is no activity, with all processes "parked".

    The idea of "parking" is blocking on the inputs to the
    protocols, or the event-driven pumps in the workers.

    The threads basically block in pselect() waiting for
    ready reading, writing, or other events, or, waiting
    on a queue item, pop().

    The leader parks in pselect() on 11-1024, the process-protocol.

    The listener parks in pselect() about
    accept() and pselect() on the listening socket and
    the process-protocol sockets.

    The worker has four or more threads.

    reader-thread: parks in pselect() with read-interest
    executor-thread: parks in pop() of application-protocol tasks
    writer-thread: parks in pop() of application-protocol responses, then
    blocks in pselect() while writing, then parks
    sweeper-thread: according to time/alarm, runs on a frequency eg 500 milliseconds, 5 seconds, 5 minutes

    When the worker is empty, after its connections close, it exits.

    The logger and metrics park in pselect() on the read-side of stdlog/stdmet/stddmp.

    Thusly, at idle, with no connections, the entire process-group is
    "parked" (0% CPU, "acquiescent").









    So, this sort of account is example, for an idea, of the considerations.

    Why this may be considered "relevant to C", vis-a-vis, say,
    "relevant to platforms & frameworks aboove the system-platform",
    is because C is the ubiquitous relevant standard to systems programming.
    Of course, C is just ubiquitous itself in accounts
    like embedded-programming, here though in a world where all the distributed-programming mostly is defined by standards that, for
    example, as described in books like "TCP/IP Illustrated" and "Network Programming", which outline in detail the implementations of
    internetworking on the Internet, C is the milieu.

    Then, "POSIX" pretty much includes C by convention and practice,
    also defining a wider surface about the runtime. So, since also
    a subset of POSIX runs on anything, here it's considered reasonably
    relevant, unless you know a newsgroup about "modular programming
    of Internet client & server and peer-to-peer platforms & frameworks
    for the modern age in its bog-standard commodity monocultures of
    systems & infrastructure", where it may be more particularly apropos.


    So what this is then is an outline of a world where long-running
    server processes, or for example looking at it the other way
    a massively parallel multi-plexing client for doing jobs,
    that the process-model is in a real world with limited resources,
    albeit then with the guarantees given, the responsibilities & guarantees.


    As you can see from reading it, or, you know, to each their own,
    the idea is that these "leader", "listener", "worker" processes
    would be alike "nntpd-leader", "nntpd-listener", "nntpd-worker",
    with regards to "named and well-known protocols and their well-known
    ports according to practice and the IANA, or for example running
    protocols on 443 since that's the only port not firewalled".

    So, the idea is that a model of a _protocol_, basically has
    bi-directional or duplex communications, about communicating
    sequential processes, these then defined in terms of the abstractions
    of the platform, here "sockets" after "files", and that's the way it
    is, then about moving & copying the data, and interpreting and invoking
    the commands as logical, and establishing and maintaining the protocols,
    since convention and specification and standard and practice.




    Now, lots of people would say, "I can only look at one thing at
    one time, if it's a process it needs to have only one PID so
    that's it". Well, I think so too, it's involved, yet as well,
    that's not the way it is. So, here this "leader" process is
    a mostly tiny process whose role mostly is to get passed a
    privileged port or ports, according to TCP/UDP/SCTP, then that
    it can run as an un-privileged user otherwise with being able
    to bind the privileged port, then it's a tiny process so that
    as it fork()'s to exec/execv/execve or create processes in a
    group of processes so managed, it's only got one-deep ancestry,
    and about how in POSIX it must manage the masks and handlers of
    process signals after "raise", "signal" or "kill", all up and
    down the tree, and that's the way it is. (Another reason to
    have only one process is to keep its quotas & limits and
    monitoring & management a single number, yet that's why it's
    in a process-group, and multiple processes for the "I/O-handle-bound
    process model", which is the way it's possible to scale it up this way,
    about 500K connections.)


    So, that thusly being as of a sort of "library" routine, for example
    that "a shell launches it and redirects its I/O the whole process-group
    how it wants", then the innards or guts, is about, "protocol-modules".
    (The process-group has its own, "process-protocol", otherwise all, "application-protocols".)


    Then, there are communicating-sequential-processes it serves, the
    frontend and, also communicating-sequential-processes its dependencies,
    the back-end, then also accounts of the half-duplex and full-duplex
    what it serves, the client-server and peer-to-peer.



    So, then for "libraries", and, "think like a library author" and
    these kinds of things, is, "components", and, "think like a component
    framework provider".



    The implementors of protocols _need not care_ about the runtime of them,
    about "a component framework for definition of protocol",
    and, "a component framework of client & server in protocol",
    or, "com-peering in protocol", then about the re-usability of
    the code, in C and not ugly and hot & fast & safe & nice.









    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sat Nov 14 17:57:50 2026
    From Newsgroup: comp.lang.c

    Ross Finlayson pisze:
    On 11/14/2026 05:19 AM, Kenny McCormack wrote:
    In article <11d9jb7$1tt0p$1@dont-email.me>, bartca <bc@freeuk.com> wrote: >>> On 14/11/2026 08:09, Kenny McCormack wrote:
    In article <11d7fbv$1839o$2@dont-email.me>,
    David Browna <david.brown@hesbynett.no> wrote:
    ...
    His posts are not written by AI - no AI writes that badly.a And it is >>>>> not so void of meaning and grammar that it is randomly generated.
    Ross
    has written posts in this style for many years in several Usenet
    groups.
    aa I find it hard to believe that someone would spend so much time and >>>>> effort for a joke.

    One word: fir.

    How about Bill Cunningham?



    Not sure I catch the reference, but I do vaguely remember that name being
    someone who used to post here.

    The thing is, though, when you get right down to it, nobody really knows
    why anyone posts here.a I think each person who does does so for personal
    reasons that are in general not fully comprehensible by anyone else.

    Take the classic question: Why does Kenny McCormack post here, when
    all he
    does is troll?a Well, he does it because it is fun and it amuses him.

    But I often ask: Why does KT post here?a Since he obviously knows
    everything there is to know about C, why bother posting here?a It's not
    like he is ever going to learn anything (since he already knows
    everything).a Now, he will say, it is because he wants to help people.
    Well, this motive is already suspect (usually people who say they want to
    help people have some other motive, sometimes in addition to a genuine
    desire to help, but sometimes as the only motive), and, secondly,
    given how
    much effort he puts into it, it is hard to believe that altruism is the
    only reason.

    And you could ask similar questions about just about everyone else who
    posts to Usenet (not just this group) ?

    And so it goes...



    Usenet is like a rather large bulletin-board system of the world,
    though I guess that's what "FIDO Net" is, federated bulletin-boards.
    Usenet has all the trappings the Internet, which it predates, i.e.
    pre-dates not pred-ates, where "predation" and "predating" are two
    different words, though, both I suppose gerunds, point being that Usenet
    has been around since before the Internet, and it has URL's and
    since every message ever posted is designed to have a unique ID,
    then also there are bibiographic citation standards about it,
    which might not mean much except that all the messages are distributed
    in the widely decentralized and available to any, in the public
    availability and not the public domain, as naturally authors maintain copyright of their postings they publish.


    Why people post to Usenet is for whatever reason they want
    and when they do is their own business, though it's rather
    explicitly not-for-commercial-purposes and it's not much
    for me to say how anti-spam works.

    Whether all gerunds end in "-ing" for example, there's a corner
    where once-upon-a-time people with strong opinions would weigh
    the question and merit the weights and politely and eruditely
    argue its alternatives, with great decorum and fine collegiality.

    ... Or flame all day, it's a free country.

    There are moderated groups, most dusty or defunct.


    Then, there are issues about that since the basically return-path
    is email, and email may be fakemail, and not all vectors into Usenet
    care, whether "Kenny McCormack", for example, inspired or mocks
    the character from "Spice Pork", who-made-who, has that it is or isn't
    so, then also that long before "A.I." was shored-up and silo'ed
    behind the more commercial accounts of "social media", there are
    tons bots among the trolls, usually with stolen identities from
    dupes on the Internet who'd never notice, yet of course that sort
    of practice is way more evident in the modern commercial accounts
    of "social media" with the "I.A.: instant audience" of simple
    bot-fan and bot-troll accounts of click-fraud and propagandist spew.


    Then, a key account of the Usenet is the co-operative aspect,
    and, "The Charter". Each Usenet group has a little charter,
    and used to be each one had a little "Frequently Asked Questions",
    or the culture, for others it's just a feed.


    Now if you'll excuse I'll go rake a leaf or wash a dish or something,
    or maybe organize my closet or or take a pick-axe to a road somewhere,
    yet, probably instead I might be further asking, or, telling, what
    sorts of accounts go into modular software in C.


    The basic idea for that is sort of an account of functions, callback-functions, and data, in the language, what's to result models
    of co-operation, about how to call various code _inside_ the runtime, vis-a-vis, various code calling _into_ the runtime, basically mirroring
    the concerns of library authors, of component authors, basically here introducing libraries vis-a-vis components, which is about as old of
    a way of looking at matters of modularity & composability as has always
    been.



    This message will have a permanent, unique ID, when it's published.


    sckets are terribly stupid im this api for sockets should look more like

    //serwer

    FILE* invitation_socket = fopen("194.122.212.32", "i");

    while(HowManyClientsWantToJoin()>0)
    {
    CLIENT_DATA* = GetWaitingClientData(invitation_socket );
    EstablishConnection(CLIENT_DATA)
    }
    /// client

    FILE* main_read = fopen("194.122.212.32", "r");
    FILE* main_write = fopen("194.122.212.32", "w");

    if(HowManyPocketsToTake(main_read )>0)
    {
    POCKET_DATA* GetPocekt(main_read );
    //...use
    }

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.lang.c on Sat Nov 14 18:20:26 2026
    From Newsgroup: comp.lang.c

    On 2026-11-14 17:17, Ross Finlayson wrote:
    [...]

    ... Or flame all day, it's a free country.

    The latter, "it's a free country", is something I regularly hear
    as statement, specifically in US movies that also play in the US.

    Usenet, the Internet, etc., being supra-national (or pan-gaea) it
    doesn't quite fit; there's countries [with Internet access] where
    folks would be very reluctant to claim such a statement.

    (Just saying...)

    Janis

    [...]

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Ross Finlayson@ross.a.finlayson@gmail.com to comp.lang.c on Sat Nov 14 10:03:51 2026
    From Newsgroup: comp.lang.c

    On 11/14/2026 09:20 AM, Janis Papanagnou wrote:
    On 2026-11-14 17:17, Ross Finlayson wrote:
    [...]

    ... Or flame all day, it's a free country.

    The latter, "it's a free country", is something I regularly hear
    as statement, specifically in US movies that also play in the US.

    Usenet, the Internet, etc., being supra-national (or pan-gaea) it
    doesn't quite fit; there's countries [with Internet access] where
    folks would be very reluctant to claim such a statement.

    (Just saying...)

    Janis

    [...]


    Sure, it's a free country, reflects on something like "The UN
    Declaration on Universal Human Rights", authored mostly by a
    Richard McKeon the great classicist and Aristotle scholar,
    and signed by one of the Roosevelt's.

    The egalitarianism in equal-rights and equal-protections under
    democracy as rule-of-law and historicism as knowing itself is
    very strongly held in many, many places, vis-a-vis Tom Paine
    after Montesquieu (sp.) and Locke since Montaigne, or DesCartes,
    for examples.

    Of course everybody's heard of Malthus & Maslow (sp.), while
    yet there are many and various accounts of will and the freedom of it.

    ("If you don't like it you can get out, ....")



    Thanks for writing.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.c on Sun Nov 15 03:10:08 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 13:07, Ross Finlayson wrote:
    On 11/13/2026 04:25 AM, Bonita Montero wrote:
    Am 12.11.2026 um 21:11 schrieb Lew Pitcher:

    Pardon my impertinence, but this sounds like a homework problem to me.
    Mabye that's the joke ! ;-)


    Humor is appreciated since it's part of bonnehomie and good-will,
    it's not a joke. (The "distance learning or distance learning"
    was a joke, about "to learn something" vis-a-vis "to learn somebody",
    yet that's just using humor instead of stronger insults or the
    abject sumbission of the door-mat variety of throwing self under the bus.)

    "I like jokes but this isn't one. Work-from-home was a trick to collect
    data about the population ..." etc.


    C++ it's said is getting reflection added to the giant tower of
    what's become of its language and libraries and idiom shoehorned

    "I read that reflection is being added to the behemoth that the C++
    language and libraries have become ..." etc


    It looks like a "precision" style-transfer has been applied.
    --
    Tristan Wibberley

    The message body is Copyright (C) 2026 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.c on Sun Nov 15 10:26:26 2026
    From Newsgroup: comp.lang.c

    On 13/11/2026 22:50, Ross Finlayson wrote:

    So, here's one. Say you got a server process for sockets of the connection-oriented or datagram-wise or association-oriented like
    TCP, UDP, or SCTP, and it manages the connecting and the sending and receiving about a million of those and is sort of fixed-size and
    stable in a usual runtime. So, how do you design the interface,
    about stuff like the state-machine of _protocols_, all about
    _protocols_, in the application-layer and above, say, for example
    the incremental-parsing and the state-machine of the protocol
    and sub-protocols and upgrade-protocols and the like, what sort
    of abstraction with suitable-defaults and reasonable-opinions
    makes for having any sort protocol as a composable library.


    For anyone who either doesn't understand that text or doesn't get how
    valuable it is just as a question unanswered: please know that it is super.

    To Ross: nobody using Usenet is going to be able to give an adequate
    answer. Maybe a dozen people on the planet can give such an answer and
    maybe each of a dozen teams of academics could do it with several years
    work.

    Now that IBM, Sun and Oracle are all dead I suppose they all work for
    Google now.
    --
    Tristan Wibberley

    The message body is Copyright (C) 2026 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sun Nov 15 12:03:54 2026
    From Newsgroup: comp.lang.c

    Tristan Wibberley pisze:
    On 13/11/2026 22:50, Ross Finlayson wrote:

    So, here's one. Say you got a server process for sockets of the
    connection-oriented or datagram-wise or association-oriented like
    TCP, UDP, or SCTP, and it manages the connecting and the sending and
    receiving about a million of those and is sort of fixed-size and
    stable in a usual runtime. So, how do you design the interface,
    about stuff like the state-machine of _protocols_, all about
    _protocols_, in the application-layer and above, say, for example
    the incremental-parsing and the state-machine of the protocol
    and sub-protocols and upgrade-protocols and the like, what sort
    of abstraction with suitable-defaults and reasonable-opinions
    makes for having any sort protocol as a composable library.


    For anyone who either doesn't understand that text or doesn't get how valuable it is just as a question unanswered: please know that it is super.

    To Ross: nobody using Usenet is going to be able to give an adequate
    answer. Maybe a dozen people on the planet can give such an answer and
    maybe each of a dozen teams of academics could do it with several years
    work.

    ai may answer it in about 10 seconds:


    C does not really need a special component model for this. Most of what
    you describe can be done with a fairly small number of ordinary C
    mechanisms, provided that the boundaries between them are made explicit.

    The important distinction, in my opinion, is between a **source
    module**, a **runtime module**, and an **interface**.

    A `.c` file is a compilation unit, not necessarily a runtime component. Several `.c` files may form one library or runtime component, while one
    `.c` file may contain several logically unrelated things. The actual
    runtime boundary is usually represented by an API and, if necessary, by
    a table of function pointers.

    For example, instead of making an object hierarchy, one can simply define:

    ```c
    struct renderer {
    void (*draw)(struct renderer *, const void *);
    void (*clear)(struct renderer *);
    void (*destroy)(struct renderer *);
    void *context;
    };
    ```

    An implementation constructs such a structure:

    ```c
    struct renderer *CreateSoftwareRenderer(void);
    struct renderer *CreateOpenGLRenderer(void);
    ```

    The rest of the program only knows about `struct renderer` and its
    contract. It does not need to know which implementation was constructed.

    That already gives you a fairly direct form of dependency injection:

    ```c
    struct renderer *renderer = CreateSoftwareRenderer();
    game.renderer = renderer;
    ```

    or, even more explicitly:

    ```c
    game.renderer.draw = SoftwareDraw;
    game.renderer.clear = SoftwareClear;
    game.renderer.destroy = SoftwareDestroy;
    game.renderer.context = &software_state;
    ```

    There is no fundamental requirement that the dependency be discovered globally. It can simply be passed to the code which needs it.

    In fact, I would say that **passing dependencies explicitly is one of
    the most natural forms of dependency injection in C**.

    The same technique works without function pointers when the dependency
    is data rather than behavior. For example:

    ```c
    struct allocator {
    void *(*alloc)(struct allocator *, size_t);
    void (*free)(struct allocator *, void *);
    void *context;
    };
    ```

    Then a subsystem can receive an allocator without knowing whether it ultimately uses `malloc`, a pool, an arena, a debug allocator, or
    something supplied by a test harness.

    This is also where ownership belongs. The interface should state things
    such as:

    ```c
    void *ResourceCreate(...);
    void ResourceDestroy(void *);
    ```

    and document who owns the returned resource and when `Destroy` must be
    called. C has no language-level ownership system, so this is part of the
    API contract rather than something the compiler enforces.

    For test-time versus run-time implementations, I would normally avoid conditional compilation inside the actual application code.

    Instead of:

    ```c
    #ifdef TEST
    ...
    #else
    ...
    #endif
    ```

    I prefer:

    ```c
    struct filesystem {
    int (*read)(struct filesystem *, ...);
    int (*write)(struct filesystem *, ...);
    void *context;
    };
    ```

    and then construct either:

    ```c
    CreateRealFilesystem(...)
    ```

    or:

    ```c
    CreateTestFilesystem(...)
    ```

    The application remains identical.

    Conditional compilation is still useful when the implementations
    themselves genuinely require different platform facilities:

    ```c
    #ifdef _WIN32
    ...
    #elif defined(__linux__)
    ...
    #endif
    ```

    or when selecting which implementation is compiled into a particular target.

    That distinction is useful:

    **conditional compilation chooses code; dependency injection chooses behavior.**

    Build systems then decide which source files participate in a target.

    For example, conceptually:

    ```text
    game
    game.c
    renderer.c
    renderer_software.c

    game_test
    game.c
    renderer.c
    renderer_test.c
    ```

    Both targets can satisfy the same interface, while linking different implementations.

    With static linking, the boundary is mostly a linker boundary. With
    dynamic linking, it can additionally become an operating-system module boundary (`DLL`, `.so`, etc.). The C interface does not fundamentally
    change.

    A DLL can export something as simple as:

    ```c
    struct renderer *CreateRenderer(void);
    ```

    and the host can obtain that symbol dynamically. The ABI then becomes
    part of the contract, which is where things such as calling conventions, structure layout, symbol visibility, versioning, and ownership across
    module boundaries become important.

    There is also no particular reason why every dependency needs to be represented by a huge nested structure of function pointers. That can
    become its own form of accidental object-oriented programming.

    Often this is enough:

    ```c
    struct game {
    struct renderer *renderer;
    struct filesystem *filesystem;
    struct clock *clock;
    };
    ```

    and each interface contains only the operations that actually belong to it.

    This gives you something resembling a manually constructed object graph:

    ```text
    game
    / | \
    / | \
    renderer filesystem clock
    | | |
    software test fake
    ```

    The graph is constructed at startup. The game does not construct its own concrete dependencies; somebody outside it does.

    That is essentially the interesting part of inversion of control in C.

    The phrase "IoC" can sound much more exotic than the mechanism actually
    is. At the simplest level it means:

    Instead of this subsystem deciding what implementation it will use,
    somebody else gives it the implementation.

    Function pointers are one way of doing that. Plain function arguments
    are another, and often the better one.

    For example, a function such as:

    ```c
    void Simulate(struct simulation *s,
    float (*random)(void),
    void (*log)(const char *));
    ```

    is already dependency injection. No component framework is required.

    Likewise, a callback is already a small form of inversion of control:

    ```c
    void EnumerateFiles(const char *path,
    void (*callback)(const char *name, void *context),
    void *context);
    ```

    The library controls the enumeration and calls code supplied by the caller.

    So I would not start by designing "components". I would start by
    identifying **contracts**.

    For each subsystem ask:

    1. What does the caller need to know?
    2. What must remain private?
    3. Who owns the resources?
    4. Which behavior needs to be replaceable?
    5. Does it actually need runtime replacement, or is link-time selection enough?
    6. Does the boundary need to cross a shared-library/ABI boundary?

    Then choose the simplest mechanism:

    ```text
    ordinary function call
    rao
    function parameter / callback
    rao
    context pointer
    rao
    struct containing function pointers
    rao
    separate static library
    rao
    dynamic library / plugin
    rao
    full component framework
    ```

    I would only move down that list when the simpler mechanism stops being sufficient.

    In particular, I would be rather suspicious of reproducing COM in C
    merely because COM solves a problem that C does not have. A table of
    function pointers plus a context pointer is already surprisingly close
    to the essential machinery of an object interface:

    ```c
    struct interface {
    void *context;

    int (*open)(void *context);
    int (*read)(void *context, void *buffer, size_t size);
    void (*close)(void *context);
    };
    ```

    The context provides instance state, the function pointers provide
    polymorphic behavior, and the header defines the contract.

    Multiple interfaces are simply multiple such tables, rather than
    multiple inheritance:

    ```c
    struct device {
    struct input_interface input;
    struct output_interface output;
    struct diagnostic_interface diagnostic;
    };
    ```

    If a component has to support querying for optional interfaces, then
    something resembling `QueryInterface()` can certainly be implemented.
    But again, that is a convention built on ordinary C rather than a
    language feature.

    There is one more important point about "modularity": **the header is
    not necessarily the interface**.

    A good C module often has:

    ```c
    foo.h
    foo.c
    ```

    where `foo.h` exposes the public contract and `foo.c` contains private structures and implementation details.

    For example:

    ```c
    /* foo.h */

    struct foo;

    struct foo *FooCreate(void);
    void FooDestroy(struct foo *);
    int FooDoSomething(struct foo *);
    ```

    while `struct foo` itself is private.

    That gives you opaque state without needing classes:

    ```c
    struct foo {
    int private_state;
    ...
    };
    ```

    The caller can hold a `struct foo *` but cannot depend on its
    representation.

    This is often more valuable for long-term modularity than adding another
    layer of function-pointer indirection.

    So, in short, C has most of the machinery being described here, but it
    is deliberately not packaged into one language-level object/component
    system.

    You have:

    ```text
    .h/.c
    raA source/module boundaries

    opaque structs
    raA encapsulation

    function pointers + context
    raA interfaces / polymorphism

    callbacks
    raA inversion of control

    explicit parameters
    raA dependency injection

    constructors/factory functions
    raA choosing implementations

    static libraries
    raA link-time composition

    shared libraries
    raA runtime composition

    build configuration
    raA selecting implementations

    explicit create/destroy contracts
    raA resource ownership
    ```

    The interesting part is not that C lacks these abstractions. It is that
    **C lets you assemble them yourself**, which means the programmer also
    has to decide where the abstraction is actually justified.

    And that last part is both C's freedom and C's trap.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Tristan Wibberley@tristan.wibberley+netnews2@alumni.manchester.ac.uk to comp.lang.c on Sun Nov 15 11:31:18 2026
    From Newsgroup: comp.lang.c

    On 12/11/2026 23:26, Janis Papanagnou wrote:

    (Disclaimer: my comments are just based on personal experience
    in our software developing practice from the 1990's and not some
    general accepted opinion or habits.)

    How could it be otherwise? With 8 billion people on the planet and
    on-demand media with algorithms capable of segmenting the population's information streams you'd never know what was generally accepted anyway.


    On "writing testable code" he wrote:

    Our approach was not to "write testable code" by _adapting_ to
    some existing framework. While we had standards and practices how
    to design software the _tests followed our software_ (not v.v.).
    One exception here was that including dedicated trace records in
    our code (that could be activated specifically WRT a module and
    in granularity) helped for the test evaluation and regressions.

    I don't really understand test trace records. It seems to me that to
    test whether certain thresholds are reached one ought to use some sort
    of COMEFROM targetting the notification call that marks said threshold
    within the program anyway - the call that triggers the real program's
    response to the threshold being breached.

    If one adds special trace markers the markers may drift away from the notification as development progresses but the real notification is all
    that's needed in the code. If necessary run unit tests under a debugger
    with a trap on the notification call to implement COMEFROM.

    The use of data instead of such callbacks has its uses in some places
    such as when the program is mapping data and the test will be
    data-driven - one datum or one partial leading sequence of the data can
    get a record output but then it should normally be percolated from the
    inside of the program using real notification calls.


    (See my comment about "tests follow code (not v.v.)". - Opinions may
    differ.)

    Tests that follow code might be good to test for operational change but
    good unit testing tests against semantic intent (even though the intent
    has been tempered by operational limits by the time the design has been
    reduced to unit interfaces), those tests /can't/ follow code. Granted
    it's hard to design without coding, but the interface typically ought to abstract the operations fully even when you've analysed your intent by codestorming.

    If all the tests follow code directly then semantic intent isn't tested.

    It's also a problem for making sure technical documentation is accurate
    because the best way to be sure it is is to write it against test passes.
    --
    Tristan Wibberley

    The message body is Copyright (C) 2026 Tristan Wibberley except
    citations and quotations noted. All Rights Reserved except that you may,
    of course, cite it academically giving credit to me, distribute it
    verbatim as part of a usenet system or its archives, and use it to
    promote my greatness and general superiority without misrepresentation
    of my opinions other than my opinion of my greatness and general
    superiority which you _may_ misrepresent. You definitely MAY NOT train
    any production AI system with it but you may train experimental AI that
    will only be used for evaluation of the AI methods it implements.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Sun Nov 15 12:43:38 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    Tristan Wibberley pisze:
    On 13/11/2026 22:50, Ross Finlayson wrote:

    So, here's one. Say you got a server process for sockets of the
    connection-oriented or datagram-wise or association-oriented like
    TCP, UDP, or SCTP, and it manages the connecting and the sending and
    receiving about a million of those and is sort of fixed-size and
    stable in a usual runtime. So, how do you design the interface,
    about stuff like the state-machine of _protocols_, all about
    _protocols_, in the application-layer and above, say, for example
    the incremental-parsing and the state-machine of the protocol
    and sub-protocols and upgrade-protocols and the like, what sort
    of abstraction with suitable-defaults and reasonable-opinions
    makes for having any sort protocol as a composable library.


    For anyone who either doesn't understand that text or doesn't get how
    valuable it is just as a question unanswered: please know that it is
    super.

    To Ross: nobody using Usenet is going to be able to give an adequate
    answer. Maybe a dozen people on the planet can give such an answer and
    maybe each of a dozen teams of academics could do it with several years
    work.

    ai may answer it in about 10 seconds:


    C does not really need a special component model for this. Most of what
    you describe can be done with a fairly small number of ordinary C mechanisms, provided that the boundaries between them are made explicit.

    The important distinction, in my opinion, is between a **source
    module**, a **runtime module**, and an **interface**.

    A `.c` file is a compilation unit, not necessarily a runtime component. Several `.c` files may form one library or runtime component, while one
    `.c` file may contain several logically unrelated things. The actual
    runtime boundary is usually represented by an API and, if necessary, by
    a table of function pointers.

    For example, instead of making an object hierarchy, one can simply define:

    ```c
    struct renderer {
    -a-a-a void (*draw)(struct renderer *, const void *);
    -a-a-a void (*clear)(struct renderer *);
    -a-a-a void (*destroy)(struct renderer *);
    -a-a-a void *context;
    };
    ```

    An implementation constructs such a structure:

    ```c
    struct renderer *CreateSoftwareRenderer(void);
    struct renderer *CreateOpenGLRenderer(void);
    ```

    The rest of the program only knows about `struct renderer` and its
    contract. It does not need to know which implementation was constructed.

    That already gives you a fairly direct form of dependency injection:

    ```c
    struct renderer *renderer = CreateSoftwareRenderer();
    game.renderer = renderer;
    ```

    or, even more explicitly:

    ```c
    game.renderer.draw = SoftwareDraw;
    game.renderer.clear = SoftwareClear;
    game.renderer.destroy = SoftwareDestroy;
    game.renderer.context = &software_state;
    ```

    There is no fundamental requirement that the dependency be discovered globally. It can simply be passed to the code which needs it.

    In fact, I would say that **passing dependencies explicitly is one of
    the most natural forms of dependency injection in C**.

    The same technique works without function pointers when the dependency
    is data rather than behavior. For example:

    ```c
    struct allocator {
    -a-a-a void *(*alloc)(struct allocator *, size_t);
    -a-a-a void (*free)(struct allocator *, void *);
    -a-a-a void *context;
    };
    ```

    Then a subsystem can receive an allocator without knowing whether it ultimately uses `malloc`, a pool, an arena, a debug allocator, or
    something supplied by a test harness.

    This is also where ownership belongs. The interface should state things
    such as:

    ```c
    void *ResourceCreate(...);
    void ResourceDestroy(void *);
    ```

    and document who owns the returned resource and when `Destroy` must be called. C has no language-level ownership system, so this is part of the
    API contract rather than something the compiler enforces.

    For test-time versus run-time implementations, I would normally avoid conditional compilation inside the actual application code.

    Instead of:

    ```c
    #ifdef TEST
    -a-a-a ...
    #else
    -a-a-a ...
    #endif
    ```

    I prefer:

    ```c
    struct filesystem {
    -a-a-a int (*read)(struct filesystem *, ...);
    -a-a-a int (*write)(struct filesystem *, ...);
    -a-a-a void *context;
    };
    ```

    and then construct either:

    ```c
    CreateRealFilesystem(...)
    ```

    or:

    ```c
    CreateTestFilesystem(...)
    ```

    The application remains identical.

    Conditional compilation is still useful when the implementations
    themselves genuinely require different platform facilities:

    ```c
    #ifdef _WIN32
    -a-a-a ...
    #elif defined(__linux__)
    -a-a-a ...
    #endif
    ```

    or when selecting which implementation is compiled into a particular
    target.

    That distinction is useful:

    **conditional compilation chooses code; dependency injection chooses behavior.**

    Build systems then decide which source files participate in a target.

    For example, conceptually:

    ```text
    game
    -a-a-a game.c
    -a-a-a renderer.c
    -a-a-a renderer_software.c

    game_test
    -a-a-a game.c
    -a-a-a renderer.c
    -a-a-a renderer_test.c
    ```

    Both targets can satisfy the same interface, while linking different implementations.

    With static linking, the boundary is mostly a linker boundary. With
    dynamic linking, it can additionally become an operating-system module boundary (`DLL`, `.so`, etc.). The C interface does not fundamentally change.

    A DLL can export something as simple as:

    ```c
    struct renderer *CreateRenderer(void);
    ```

    and the host can obtain that symbol dynamically. The ABI then becomes
    part of the contract, which is where things such as calling conventions, structure layout, symbol visibility, versioning, and ownership across
    module boundaries become important.

    There is also no particular reason why every dependency needs to be represented by a huge nested structure of function pointers. That can
    become its own form of accidental object-oriented programming.

    Often this is enough:

    ```c
    struct game {
    -a-a-a struct renderer *renderer;
    -a-a-a struct filesystem *filesystem;
    -a-a-a struct clock *clock;
    };
    ```

    and each interface contains only the operations that actually belong to it.

    This gives you something resembling a manually constructed object graph:

    ```text
    -a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a game
    -a-a-a-a-a-a-a-a-a-a-a-a-a /-a-a |-a-a-a \
    -a-a-a-a-a-a-a-a-a-a-a-a /-a-a-a |-a-a-a-a \
    -a-a-a-a-a-a renderer filesystem clock
    -a-a-a-a-a-a-a-a-a |-a-a-a-a-a-a-a-a-a |-a-a-a-a-a-a |
    -a-a-a-a-a software-a-a-a-a test-a-a-a fake
    ```

    The graph is constructed at startup. The game does not construct its own concrete dependencies; somebody outside it does.

    That is essentially the interesting part of inversion of control in C.

    The phrase "IoC" can sound much more exotic than the mechanism actually
    is. At the simplest level it means:

    Instead of this subsystem deciding what implementation it will use,
    somebody else gives it the implementation.

    Function pointers are one way of doing that. Plain function arguments
    are another, and often the better one.

    For example, a function such as:

    ```c
    void Simulate(struct simulation *s,
    -a-a-a-a-a-a-a-a-a-a-a-a-a float (*random)(void),
    -a-a-a-a-a-a-a-a-a-a-a-a-a void (*log)(const char *));
    ```

    is already dependency injection. No component framework is required.

    Likewise, a callback is already a small form of inversion of control:

    ```c
    void EnumerateFiles(const char *path,
    -a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a void (*callback)(const char *name, void *context),
    -a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a void *context);
    ```

    The library controls the enumeration and calls code supplied by the caller.

    So I would not start by designing "components". I would start by
    identifying **contracts**.

    For each subsystem ask:

    1. What does the caller need to know?
    2. What must remain private?
    3. Who owns the resources?
    4. Which behavior needs to be replaceable?
    5. Does it actually need runtime replacement, or is link-time selection enough?
    6. Does the boundary need to cross a shared-library/ABI boundary?

    Then choose the simplest mechanism:

    ```text
    ordinary function call
    -a-a-a-a-a-a-a rao
    function parameter / callback
    -a-a-a-a-a-a-a rao
    context pointer
    -a-a-a-a-a-a-a rao
    struct containing function pointers
    -a-a-a-a-a-a-a rao
    separate static library
    -a-a-a-a-a-a-a rao
    dynamic library / plugin
    -a-a-a-a-a-a-a rao
    full component framework
    ```

    I would only move down that list when the simpler mechanism stops being sufficient.

    In particular, I would be rather suspicious of reproducing COM in C
    merely because COM solves a problem that C does not have. A table of function pointers plus a context pointer is already surprisingly close
    to the essential machinery of an object interface:

    ```c
    struct interface {
    -a-a-a void *context;

    -a-a-a int-a (*open)(void *context);
    -a-a-a int-a (*read)(void *context, void *buffer, size_t size);
    -a-a-a void (*close)(void *context);
    };
    ```

    The context provides instance state, the function pointers provide polymorphic behavior, and the header defines the contract.

    Multiple interfaces are simply multiple such tables, rather than
    multiple inheritance:

    ```c
    struct device {
    -a-a-a struct input_interface input;
    -a-a-a struct output_interface output;
    -a-a-a struct diagnostic_interface diagnostic;
    };
    ```

    If a component has to support querying for optional interfaces, then something resembling `QueryInterface()` can certainly be implemented.
    But again, that is a convention built on ordinary C rather than a
    language feature.

    There is one more important point about "modularity": **the header is
    not necessarily the interface**.

    A good C module often has:

    ```c
    foo.h
    foo.c
    ```

    where `foo.h` exposes the public contract and `foo.c` contains private structures and implementation details.

    For example:

    ```c
    /* foo.h */

    struct foo;

    struct foo *FooCreate(void);
    void FooDestroy(struct foo *);
    int FooDoSomething(struct foo *);
    ```

    while `struct foo` itself is private.

    That gives you opaque state without needing classes:

    ```c
    struct foo {
    -a-a-a int private_state;
    -a-a-a ...
    };
    ```

    The caller can hold a `struct foo *` but cannot depend on its representation.

    This is often more valuable for long-term modularity than adding another layer of function-pointer indirection.

    So, in short, C has most of the machinery being described here, but it
    is deliberately not packaged into one language-level object/component system.

    You have:

    ```text
    .h/.c
    -a-a-a raA source/module boundaries

    opaque structs
    -a-a-a raA encapsulation

    function pointers + context
    -a-a-a raA interfaces / polymorphism

    callbacks
    -a-a-a raA inversion of control

    explicit parameters
    -a-a-a raA dependency injection

    constructors/factory functions
    -a-a-a raA choosing implementations

    static libraries
    -a-a-a raA link-time composition

    shared libraries
    -a-a-a raA runtime composition

    build configuration
    -a-a-a raA selecting implementations

    explicit create/destroy contracts
    -a-a-a raA resource ownership
    ```

    The interesting part is not that C lacks these abstractions. It is that
    **C lets you assemble them yourself**, which means the programmer also
    has to decide where the abstraction is actually justified.

    And that last part is both C's freedom and C's trap.


    note i dont personally use this above approch

    generally i write a program when its verious parts are vaguelly
    dependant... its not necessary good and i think more recently about this pinpoints

    coz parts of program together may bring a mess
    for example in my rasterizer/shoter 3d game prototype there is
    general window part (which reads keyboard uses some kays and also "uses hud"..and inner 3d game part which also uses keyboard/mouse and hud

    it generates some mess poteintially..especially as 1 i need to manage
    some states like 2d/3d mode of window, yet two modes of camera in 3d
    mode - states become to born mess..other problem is various parts ot
    this 3d game may use those keys and hud and so,etimes it become hard to
    find ehere is what..yet i got a problem with fainding some functions sometimes..as sometimes some tiny usefull functions may belong to some modules/files but they belonging is not so obvious so if such function
    can be in five places you will notice a serious hangout in your head
    localizing it

    its sometimes good to make "hard split" and put one part into dll
    but managing this dll is slightly more burdensome than having it all
    together so i probably prefer make this split in more heavier cases only
    (im not yet quite sure - before i used dll long time, only recently in
    case of revriting things i redigned the dll..and now i both slightly
    miss it and possibly somewhat less slightly dont miss it (miss its good
    side dont miss its bad side)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c on Mon Nov 16 16:23:23 2026
    From Newsgroup: comp.lang.c

    Am 12.11.2026 um 21:15 schrieb Chris M. Thomasson:

    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.

    A frequently cited point in this context is that `std::sort()` is
    typically many times faster than `qsort()`, thanks to the inlining
    of the function object. Furthermore, a function object can easily
    incorporate an external context by capturing it within a lambdarCo
    something that is simply not possible with `qsort()`, where a C
    -style comparison function is restricted to accessing only global
    variables. This falls far short of the capabilities offered by
    functional programming. In other words: C is incapable of func-
    tional programming.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Mon Nov 16 16:29:39 2026
    From Newsgroup: comp.lang.c

    Bonita Montero pisze:
    Am 12.11.2026 um 21:15 schrieb Chris M. Thomasson:

    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.

    A frequently cited point in this context is that `std::sort()` is
    typically many times faster than `qsort()`, thanks to the inlining
    of the function object. Furthermore, a function object can easily
    incorporate an external context by capturing it within a lambdarCo
    something that is simply not possible with `qsort()`, where a C
    -style comparison function is restricted to accessing only global
    variables. This falls far short of the capabilities offered by
    functional programming. In other words: C is incapable of func-
    tional programming.

    you can write you own sort or paste if trom the net and its not worse
    than c++

    in some thread on this as maybe you remember i taka a contest ;c on c++
    sort and beat it much (as far as i remember by code taken from net)

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Mon Nov 16 16:35:58 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    Bonita Montero pisze:
    Am 12.11.2026 um 21:15 schrieb Chris M. Thomasson:

    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.

    A frequently cited point in this context is that `std::sort()` is
    typically many times faster than `qsort()`, thanks to the inlining
    of the function object. Furthermore, a function object can easily
    incorporate an external context by capturing it within a lambdarCo
    something that is simply not possible with `qsort()`, where a C
    -style comparison function is restricted to accessing only global
    variables. This falls far short of the capabilities offered by
    functional programming. In other words: C is incapable of func-
    tional programming.

    you can write you own sort or paste if trom the net and its not worse
    than c++

    in some thread on this as maybe you remember i taka a contest ;c on c++
    sort and beat it much (as far as i remember by code taken from net)

    my own quote from google groups

    "
    fir
    23 kwi 2022, 12:35:57
    do
    try radix sort, i once measured that things (on 10-yo old machine) and
    testing sorting 1MB of integers and remember c quicksort (like that from wikipedia) have 150 ms , c++ std:sort 111 ms,
    c insertsort 111 ms also or 2 ms worse something like that, c-radix sort (taken from stack overflow) 17 ms beating c++:stdsort more than 3 times
    for more details search "quicksort" in this group (the search in google
    groups work).."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Mon Nov 16 16:38:25 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    fir pisze:
    Bonita Montero pisze:
    Am 12.11.2026 um 21:15 schrieb Chris M. Thomasson:

    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.

    A frequently cited point in this context is that `std::sort()` is
    typically many times faster than `qsort()`, thanks to the inlining
    of the function object. Furthermore, a function object can easily
    incorporate an external context by capturing it within a lambdarCo
    something that is simply not possible with `qsort()`, where a C
    -style comparison function is restricted to accessing only global
    variables. This falls far short of the capabilities offered by
    functional programming. In other words: C is incapable of func-
    tional programming.

    you can write you own sort or paste if trom the net and its not worse
    than c++

    in some thread on this as maybe you remember i taka a contest ;c on c++
    sort and beat it much (as far as i remember by code taken from net)

    my own quote from google groups

    "
    fir
    23 kwi 2022, 12:35:57
    do
    try radix sort, i once measured that things (on 10-yo old machine) and testing sorting 1MB of integers and remember c quicksort (like that from wikipedia) have 150 ms , c++ std:sort 111 ms,
    c insertsort 111 ms also or 2 ms worse something like that, c-radix sort (taken from stack overflow) 17 ms beating c++:stdsort more than 3 times
    for more details search "quicksort" in this group (the search in google groups work).."

    see here
    https://groups.google.com/g/comp.lang.c/c/I4lJSh45EJ0/m/ezGwgnvWDgAJ
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From fir@profesor.fir@gmail.com to comp.lang.c on Mon Nov 16 16:39:03 2026
    From Newsgroup: comp.lang.c

    fir pisze:
    fir pisze:
    fir pisze:
    Bonita Montero pisze:
    Am 12.11.2026 um 21:15 schrieb Chris M. Thomasson:

    C is C. Imvvvvho, C++ is better... :^) Let the flames begin.

    A frequently cited point in this context is that `std::sort()` is
    typically many times faster than `qsort()`, thanks to the inlining
    of the function object. Furthermore, a function object can easily
    incorporate an external context by capturing it within a lambdarCo
    something that is simply not possible with `qsort()`, where a C
    -style comparison function is restricted to accessing only global
    variables. This falls far short of the capabilities offered by
    functional programming. In other words: C is incapable of func-
    tional programming.

    you can write you own sort or paste if trom the net and its not worse
    than c++

    in some thread on this as maybe you remember i taka a contest ;c on c++
    sort and beat it much (as far as i remember by code taken from net)

    my own quote from google groups

    "
    fir
    23 kwi 2022, 12:35:57
    do
    try radix sort, i once measured that things (on 10-yo old machine) and
    testing sorting 1MB of integers and remember c quicksort (like that
    from wikipedia) have 150 ms , c++ std:sort 111 ms,
    c insertsort 111 ms also or 2 ms worse something like that, c-radix
    sort (taken from stack overflow) 17 ms beating c++:stdsort more than 3
    times
    for more details search "quicksort" in this group (the search in
    google groups work).."

    see here https://groups.google.com/g/comp.lang.c/c/I4lJSh45EJ0/m/ezGwgnvWDgAJ

    lame c++ bonita
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c on Mon Nov 16 17:31:00 2026
    From Newsgroup: comp.lang.c

    I wrote a comparison between std::sort() and qsort() to sort an array of
    4096 ints (fits in L1). On my Zen4-PC std::sort() is 4.8 times faster.
    Any question ?

    #include <iostream>
    #include <algorithm>
    #include <cstdlib>
    #include <chrono>
    #include <vector>
    #include <random>

    using namespace std;
    using namespace chrono;

    int main()
    {
    constexpr size_t
    N = 0x1000,
    Rounds = 10'000;
    auto test = []( auto fn ) -> double
    {
    time_point start = steady_clock::now();
    for( size_t r = Rounds; r; --r )
    fn();
    duration dur = steady_clock::now() - start;
    return (double)duration_cast<nanoseconds>( dur ).count();
    };
    vector<int>
    origin( N ),
    srt( N );
    mt19937_64 mt;
    for( int &i : origin )
    i = (int)mt();
    int dummy = 0;
    auto cpy = [&] { copy( origin.begin(), origin.end(), srt.begin() ); dummy += srt[0]; };
    double tRef = test( cpy );
    auto qsrt = [&]
    {
    cpy();
    qsort( srt.data(), srt.size(), sizeof( int ), +[]( const void *lhs,
    const void *rhs ) -> int
    {
    int &iLhs = *(int *)lhs, &iRhs = *(int *)rhs;
    if( iLhs == iRhs )
    return 0;
    return iLhs < iRhs ? -1 : 1;
    } );
    dummy += srt[0];
    };
    double tQsrt = test( qsrt ) - tRef;
    auto stdSrt = [&]
    {
    cpy();
    sort( srt.begin(), srt.end(), less() );
    dummy += srt[0];
    };
    double tStdSrt = test( stdSrt ) - tRef;
    cout << tQsrt / tStdSrt << endl;
    return dummy;
    }


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c on Mon Nov 16 17:32:45 2026
    From Newsgroup: comp.lang.c

    Am 16.11.2026 um 16:39 schrieb fir:

    fir pisze:

    see here https://groups.google.com/g/comp.lang.c/c/I4lJSh45EJ0/m/
    ezGwgnvWDgAJ

    lame c++ bonita

    See my other post - you suck !
    --- Synchronet 3.22a-Linux NewsLink 1.2