• =?UTF-8?Q?Re=3A_=E2=80=9CThe_end_of_software_secrecy_is_almost_upon?=

    From David Brown@david.brown@hesbynett.no to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 12:43:02 2026
    From Newsgroup: comp.lang.c++

    On 23/10/2026 18:57, Peter Flass wrote:
    On 10/23/26 02:45, David Brown wrote:
    On 23/10/2026 08:25, Lawrence DrCOOliveiro wrote:
    On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:

    On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:

    On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:

    That's why I try to use PL/I AUTOMATIC (stack) storage and not
    allocate a lot of stuff. You need to have a disciplined approach
    if you allocate random stuff here and there.

    What if yourCOre building an object that needs to be returned to the >>>>> caller?

    Have the caller have the object before hand and call a function to
    initialize it?

    IrCOm assuming that all that BASIC programming hasnrCOt got to your head, >>> and yourCOre not serious. ;)

    Chris' wording is perhaps poor, but the principle is right.

    I don't know PL/I or Fortran, but in C if you have :

    -a-a-a-a-atypedef struct data_struct { int a; int xs[20]; } S ;

    -a-a-a-a-aS build_some_data(void) {
    -a-a-a-a-a-a-a-a S s;

    -a-a-a-a-a-a-a-a s.a = 123;
    -a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) s.xs[i] = i;

    -a-a-a-a-a-a-a-a return s;
    -a-a-a-a-a}

    -a-a-a-a-avoid foo() {
    -a-a-a-a-a-a-a-a S s = build_some_data();
    -a-a-a-a-a}


    then it is typically handled as though you had written :

    -a-a-a-a-avoid build_some_data(S * p) {
    -a-a-a-a-a-a-a-a p->a = 123;
    -a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) p->xs[i] = i;

    -a-a-a-a-a-a-a-a return;
    -a-a-a-a-a}

    -a-a-a-a-avoid foo() {
    -a-a-a-a-a-a-a-a S s;
    -a-a-a-a-a-a-a-a build_some_data(&s);
    -a-a-a-a-a}


    That is - the caller creates the /space/ for the returned object, but
    does not do any kind of initialisation.-a It passes a pointer to that
    space as a hidden parameter to the function that wants to return the
    object.

    That principle should work fine in any language, as long as the size
    of the returned object is known by the caller code.

    That last sentence is why it would not work fine,

    OK. Knowing the size of the returned object is an absolute requirement
    for pre-allocation by the caller, and it is a requirement that is fine
    for a lot of situations and a lot of languages. But if it is not the
    case for PL/I, Fortran, or any other particular language (or particular function in any language), then I fully agree - the object's space can't
    be handled by the caller.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Gary R. Schmidt@grschmidt@acm.org to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 01:03:05 2026
    From Newsgroup: comp.lang.c++

    On 24/10/2026 03:06, Peter Flass wrote:
    On 10/23/26 01:01, boltar@caprica.universe wrote:
    On Thu, 22 Oct 2026 12:19:49 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bd7tj$rh4f$1@dont-email.me>,-a <boltar@battlestar.co.uk>
    wrote:

    Most of us have a CS degree. But then we go out into the real world,
    get a
    job and find out what real programming on real products entails, not
    a load
    of virtual academic naval gazing.

    That's because it's not a trade school degree.-a It's not there to teach >>> you to program, it's there to teach you the fundamentals that you
    need to
    properly understand programming.

    No, it teaches you fundamentals of certain aspects of computer
    paradigms such
    as databases, graphics, AI. Most people into computers learn actual
    programming
    long before they hit university.

    Engineering schools are even more that way.-a They don't teach you much
    engineering, but they give you all the background that you need to learn >>> engineering.

    Programming isn't pure engineering - its a combination of engineering,
    logic,
    art and a trade.

    If you just want a job, getting one of these degrees is not for you.
    It's
    not there for that.

    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though.

    A story I heard thirty-odd years ago about Bill Gates' purported
    programming ability:
    When MS started making money from their MSBASIC compiler, they started
    hiring real staff.
    One of them was tasked with working through the various functions that
    BASIC does, such as opening files, sorting arrays, and the like.
    When he looked at the sort routine, he exclaimed, loudly, "What idiot
    wrote this, it doesn't do anything!"
    Bill was in the room at the time, wandered over and had a look at what
    they were working on, and said, "Oh, the sort routine. I could never
    get that to work."
    Apparently it was not a career-limiting action by the programmer.

    Cheers,
    Gary B-)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From scott@scott@slp53.sl.home (Scott Lurndal) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 14:25:36 2026
    From Newsgroup: comp.lang.c++

    boltar@caprica.universe writes:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads >>>>>in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>operating system. I mean, POSIX already does an ok job of >>>>standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but >>>not a process library. Its perfectly possible to simulate a multiprocess >>>enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    It doesn't. It does have an abstraction wrapper around
    whatever threading support the target host has.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 07:26:04 2026
    From Newsgroup: comp.lang.c++

    On 10/24/26 01:21, boltar@caprica.universe wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>> On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but >>> not a process library. Its perfectly possible to simulate a multiprocess >>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    You can have co-operative threads. IBM CICS used to run lots of threads (tasks) concurrently, and ran them well.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 14:51:36 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 14:25:36 GMT
    scott@slp53.sl.home (Scott Lurndal) gabbled:
    boltar@caprica.universe writes:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:

    You need an OS to do threading properly too. Theres a reason green threads

    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>>operating system. I mean, POSIX already does an ok job of >>>>>standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but >>>>not a process library. Its perfectly possible to simulate a multiprocess >>>>enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    It doesn't. It does have an abstraction wrapper around
    whatever threading support the target host has.

    And iostream is an abstraction around low level C I/O, whats your point?

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 22:55:42 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 10:25 PM, Scott Lurndal wrote:
    boltar@caprica.universe writes:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    It doesn't. It does have an abstraction wrapper around
    whatever threading support the target host has.

    I don't think that's true. I currently believe, and I'm very welcoming
    of an alt.folklore.computers expert to correct me, that the Vista+
    threading model that looks extremely much like the Posix threads, only
    the names of the routines were changed, was put in place exactly to sup-
    port the C++ threading model.

    I mean, /why else/ would Microsoft bend backwards and admit their ear-
    lier Win32 threading model was flawed? And why have a subset of the Po-
    six threads and not the full thing? A side by side comparison of the
    C++ threading model might be enlightening, but I have not done this
    textbook exercise myself just yet.


    What do you think, Scott?
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
    Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 16:41:22 2026
    From Newsgroup: comp.lang.c++

    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote: >On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads >>>>>in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>operating system. I mean, POSIX already does an ok job of >>>>standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but >>>not a process library. Its perfectly possible to simulate a multiprocess >>>enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    - Dan C.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From kludge@kludge@panix.com (Scott Dorsey) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:53:39 2026
    From Newsgroup: comp.lang.c++

    In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote: >Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
    On 10/23/2026 11:06 AM, Peter Flass wrote:
    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though.

    Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>Altair 8080 in 2K of ram using assembly language. Take that as you will.

    Gates when he put his mind to it could certainly program. Even Sinclair >required 4K for BASIC in the ZX80 for example. But some of his technical
    (and business) decisions leave a lot to be desired.

    But the ZX80 (and most later MBASICs) had floating point.
    --scott
    --
    "C'est un Nagra. C'est suisse, et tres, tres precis."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From kludge@kludge@panix.com (Scott Dorsey) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:57:02 2026
    From Newsgroup: comp.lang.c++

    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/24/26 01:21, boltar@caprica.universe wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    You can have co-operative threads. IBM CICS used to run lots of threads >(tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different processes, so you had to do a fork and then synchronize with the other
    process. This wasn't a dealbreaker and we did plenty of stuff that way,
    but having threads available was very nice and made for many operations becoming more convenient to write.
    --scott
    --
    "C'est un Nagra. C'est suisse, et tres, tres precis."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 12:17:47 2026
    From Newsgroup: comp.lang.c++

    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    - Dan C.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:07:38 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 7:25 AM, Scott Lurndal wrote:
    boltar@caprica.universe writes:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    It doesn't. It does have an abstraction wrapper around
    whatever threading support the target host has.

    But at least they are std now since C++11? Before it was use POSIX and
    hope the compiler is compliant.

    Actually, the most import aspect, imvvho, is std::atomic.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:12:27 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 9:41 AM, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Well, if a thread crashes, segfaults, etc it can destroy the whole
    process. But, in multi process. If a process dies, the things can be
    recovered and still run. Take a look at robust mutexes. EOWNERDEAD ?

    [...]

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:26:07 2026
    From Newsgroup: comp.lang.c++

    On 10/23/2026 8:33 PM, Lawrence DrCOOliveiro wrote:
    On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:

    On 10/23/2026 3:42 PM, Lawrence DrCOOliveiro wrote:

    On Fri, 23 Oct 2026 13:56:49 -0700, Chris M. Thomasson wrote:

    On 10/23/2026 12:19 PM, Lawrence DrCOOliveiro wrote:

    In short, the concept doesnrCOt scale, because it completely breaks
    the concept of data abstraction.

    And it just pushes the dynamic-allocation problem elsewhere,
    without making it easier.

    It can be made to work ...

    IrCOm sure itrCOs *possible*, but what is the *point*?

    The whole aim of levels of abstraction is to tame the multi-headed
    beast of complexity that is computer programming. What you are
    doing here is breaking down those levels, all in the aid of, I
    donrCOt know, just to keep using gotos in your code, or something.

    Well, not about goto's and such. Just so a lib can inform the caller
    as to what it needs to work with. The caller sets it up, then calls
    into the init etc. Its being used in a lot of places. Take Vulkan.

    Where in Vulkan? Exposing implementation details to the caller not
    only increases complexity, it also limits the implementorrCOs ability to change those details later.

    Iiic, vkGetBufferMemoryRequirements and vkGetImageMemoryRequirements,
    which return a VkMemoryRequirements struct containing size, alignment,
    and memoryTypeBits. The caller allocates the memory with
    vkAllocateMemory and binds it with vkBindBufferMemory.

    Also, iirc io_uring: IORING_SETUP_NO_MMAP (Linux 6.5+) lets the caller
    supply the memory for the rings and SQE array. It must be suitably
    aligned (page or huge page), and the caller has to compute how big it
    needs to be from the entry count and flags.

    So it can be made to work.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 13:27:30 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 1:26 PM, Chris M. Thomasson wrote:
    Iiic, vkGetBufferMemoryRequirements and vkGetImageMemoryRequirements,
    which return a VkMemoryRequirements struct containing size, alignment,
    and memoryTypeBits. The caller allocates the memory with
    vkAllocateMemory and binds it with vkBindBufferMemory.

    Also, iirc io_uring: IORING_SETUP_NO_MMAP (Linux 6.5+) lets the caller supply the memory for the rings and SQE array. It must be suitably
    aligned (page or huge page), and the caller has to compute how big it
    needs to be from the entry count and flags.

    So it can be made to work.

    Or what about miniaudiorCOs ma_engine_get_heap_size plus ma_engine_init_preallocated
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 21:24:58 2026
    From Newsgroup: comp.lang.c++

    In article <11bj08r$309uk$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason green threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    - Dan C.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 22:32:03 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 13:26:07 -0700, Chris M. Thomasson wrote:

    On 10/23/2026 8:33 PM, Lawrence DrCOOliveiro wrote:

    On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:

    On 10/23/2026 3:42 PM, Lawrence DrCOOliveiro wrote:

    The whole aim of levels of abstraction is to tame the
    multi-headed beast of complexity that is computer programming.
    What you are doing here is breaking down those levels, all in the
    aid of, I donrCOt know, just to keep using gotos in your code, or
    something.

    Well, not about goto's and such. Just so a lib can inform the
    caller as to what it needs to work with. The caller sets it up,
    then calls into the init etc. Its being used in a lot of places.
    Take Vulkan.

    Where in Vulkan? Exposing implementation details to the caller not
    only increases complexity, it also limits the implementorrCOs ability
    to change those details later.

    Iiic, vkGetBufferMemoryRequirements and
    vkGetImageMemoryRequirements, which return a VkMemoryRequirements
    struct containing size, alignment, and memoryTypeBits. The caller
    allocates the memory with vkAllocateMemory and binds it with vkBindBufferMemory.

    I had a quick look at that. It seems to have to do with the reality of
    graphics hardware implementing different kinds of memory with
    different kinds of characteristics, and the impossibility of
    completely such ignoring such issues in real-time 3D rendering.

    I expect higher-level APIs (e.g. game engines) will wrap all this
    behind their own higher-level abstractions, so regular
    programmers/game creators donrCOt have to worry about it.

    In short, itrCOs an abstraction that leaks that you accept only because
    you have to, not because itrCOs a good idea for abstractions in general.
    If you can successfully hide issues of memory and other resource
    allocation behind your abstraction, you would still rather do it than
    not.

    So, to get back to my point, the technique I use is based on a form of structured programming called a rCLNassi-Shneiderman diagramrCY. The
    overall structure looks like

    ... initialize object pointer to NULL ...
    do /*once*/
    {
    ... possible other stuff ...
    ... allocate object pointer ...
    if (error occurred)
    break;
    ... possible other stuff using object pointer ...
    }
    while (false);
    ... call free(3) (or equivalent) on object pointer ...

    So you can see there is no way out of the inner block without passing
    through the dispose call. Using gotos would contribute nothing except
    make it harder to assure yourself of the simplicity of the control
    flow.

    Looks deceptively simple. But the same technique can scale up to quite
    complex cases.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 24 22:32:25 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:

    Or what about miniaudiorCOs ma_engine_get_heap_size plus ma_engine_init_preallocated

    No idea about that, but the same principle would apply.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:31:00 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 16:41:22 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote: >>On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:

    You need an OS to do threading properly too. Theres a reason green threads

    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>>operating system. I mean, POSIX already does an ok job of >>>>>standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but >>>>not a process library. Its perfectly possible to simulate a multiprocess >>>>enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    The differences are utterly irrelevant when it comes to prividing a common
    API to the functionality but thank you for demonstrating you had no answer
    to my question.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:32:33 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 13:53:39 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote: >>Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
    On 10/23/2026 11:06 AM, Peter Flass wrote:
    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though.

    Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>Altair 8080 in 2K of ram using assembly language. Take that as you will.

    Gates when he put his mind to it could certainly program. Even Sinclair >>required 4K for BASIC in the ZX80 for example. But some of his technical >>(and business) decisions leave a lot to be desired.

    But the ZX80 (and most later MBASICs) had floating point.

    The ZX80 ran Sinclair Basic, it had nothing to do with MS and it was integer only. The ZX81 had flowing point basic and had an 8K ROM which is still
    bloody impressive.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:34:20 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of threads >>(tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different >processes, so you had to do a fork and then synchronize with the other >process. This wasn't a dealbreaker and we did plenty of stuff that way,
    but having threads available was very nice and made for many operations >becoming more convenient to write.

    Unfortunately most win32 programmers don't really understand multiprocess programming because the w32 API is so borked so use threads even when
    seperate process would be more appropriate.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:37:22 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bj08r$309uk$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> >wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> >wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:

    You need an OS to do threading properly too. Theres a reason green >threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library >but
    not a process library. Its perfectly possible to simulate a multiprocess >>>>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual >>memory, who knows?)

    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    Who mentioned C? I was talking about C++ which has a threading API already.
    Do try and keep up.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:42:47 2026
    From Newsgroup: comp.lang.c++

    On Sat, 24 Oct 2026 12:17:47 -0700
    Peter Flass <Peter@Iron-Spring.com> gabbled:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    - Dan C.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    With copy-on-write process models the actual difference is a bit less
    clear cut.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 10:45:45 2026
    From Newsgroup: comp.lang.c++

    On 25/10/2026 00:11, Michael S wrote:
    On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) wrote:

    In article <11bj08r$309uk$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>,
    <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>,
    <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>,
    <boltar@battlestar.co.uk> wrote:

    You need an OS to do threading properly too. Theres a reason >>>>>>>>> green threads in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>>>>> operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading
    library but not a process library. Its perfectly possible to
    simulate a multiprocess enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    - Dan C.


    First, he was talking about C++. Unlike me, he does not appear to care
    about C.
    Second, while in theory threads can be implemented by C++
    compilers+language support library, in practice I had never seen it
    done. All I had seen is C++ threads implemented in library as thin
    wrapper atop of the OS (or RT executive) implementation.
    I can not see while the same can't be done for processes, with
    API modeled on posix_spawn() or Windows CreateProcess().
    It does not look like variety in this field is bigger than in case of threads. More like it is smaller.


    No one is suggesting that the threads themselves are implemented in
    pure, standard, portable C++. You need an underlying OS or support of
    some sort if you are going to have preemptable threads. It's the same principle as IO and file access.

    But the difference between threads and processes is very simple from the viewpoint of C and C++. Suppose you have a global (i.e., external
    linkage) variable :

    int x;

    Two threads that have "int a = x;" see the same "x" (ignoring data races
    and synchronisation). Two processes see completely different "x".

    With threads, you are still within the same program execution - the same
    code, the same data. Thus it is appropriate that the language can
    describe the threads, and provide an execution model that can describe
    what is safe and unsafe for sharing the data. It is then highly useful
    for the programmer to have some standard data types and functions for
    doing this safe access, and wrappers around common OS functions for threads.

    With processes, you have two separate programs. Usually it is different
    code and data (with a spawn), sometimes it is the same code and a copy
    of the data (with a fork). But the programs are separate. C and C++
    model programs, not systems of programs. It is not more part of C and
    C++ than details of the filesystem.

    Of course the standard library could provide some standard wrappers for
    spawn, fork, and related process control functions. But what use would
    they be? Many of the details are OS-specific - for example, you'd
    either have to say that C++ programmers on Linux don't get "fork", or
    that C++ programmers on Windows get "fork" without realising the massive overheads involved in emulating it.

    It would be possible, of course, to have some standard library classes
    and functions here - with optional parts to make it useable on common
    OS'es. But it is very different from threading, which is integral to
    the execution model of C++ and C (since C++11 and C11) - it is that
    model that makes threading integration important. Wrappers around
    common OS calls is unlikely to give programmers anything significant.


    Now, would it be the first thing I would want like addition to C++
    standard library? No it would not be.
    The first thing would be IPv4 communication, sockets, poll etc...


    That's more realistic, and potentially more useful. And it is in
    progress. (I haven't tracked the progress for the networking TS - but
    it seems to be a lot more work than originally anticipated.)


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From kludge@kludge@panix.com (Scott Dorsey) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:10:08 2026
    From Newsgroup: comp.lang.c++

    In article <11bker0$2pa7q$1@dont-email.me>, <boltar@caprica.universe> wrote: >On Sat, 24 Oct 2026 13:53:39 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
    On 10/23/2026 11:06 AM, Peter Flass wrote:
    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though.

    Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>>Altair 8080 in 2K of ram using assembly language. Take that as you will. >>>
    Gates when he put his mind to it could certainly program. Even Sinclair >>>required 4K for BASIC in the ZX80 for example. But some of his technical >>>(and business) decisions leave a lot to be desired.

    But the ZX80 (and most later MBASICs) had floating point.

    The ZX80 ran Sinclair Basic, it had nothing to do with MS and it was integer >only. The ZX81 had flowing point basic and had an 8K ROM which is still >bloody impressive.

    I did not realize that the ZX80 was integer only! I thought it was more
    or less like the ZX81 with everything stuffed into an asic.
    --scott
    --
    "C'est un Nagra. C'est suisse, et tres, tres precis."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 08:41:47 2026
    From Newsgroup: comp.lang.c++

    On 10/25/26 06:34, Dan Cross wrote:
    In article <11bkfcc$104cc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    [snip]

    No, it isn't. How similar do you think the posix and windows threading
    model/api are? Yet somehow C++ provides a common wrapper for both. There is >> no reason the same can't be done for processes and your irrelevant waffle
    about past issues of threading on *nix don't change that.

    You didn't answer my questions.

    What do you think that a "thread" is?
    What do you think that a "process" is?

    - Dan C.

    I vote that alt.folklore.computers gets pruned from the list of
    recipients, as this discussion seems irrelevant here.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From cross@cross@spitfire.i.gajendra.net (Dan Cross) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 17:06:47 2026
    From Newsgroup: comp.lang.c++

    In article <11bl7vr$3nprb$2@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/25/26 06:34, Dan Cross wrote:
    [snip]
    What do you think that a "thread" is?
    What do you think that a "process" is?

    I vote that alt.folklore.computers gets pruned from the list of
    recipients, as this discussion seems irrelevant here.

    I'm happy defer to others here, but I disagree with the premise.
    Concurrency and parallelism are useful abstractions with a rich
    history encompassing both languages and operating systems. In
    that sense they seem eminently relevant to a.f.c.

    - Dan C.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Cryptoengineer@petertrei@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 13:58:43 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:10 AM, Scott Dorsey wrote:
    In article <11bker0$2pa7q$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Sat, 24 Oct 2026 13:53:39 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote:
    Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
    On 10/23/2026 11:06 AM, Peter Flass wrote:
    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though. >>>>>
    Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>>> Altair 8080 in 2K of ram using assembly language. Take that as you will. >>>>
    Gates when he put his mind to it could certainly program. Even Sinclair >>>> required 4K for BASIC in the ZX80 for example. But some of his technical >>>> (and business) decisions leave a lot to be desired.

    But the ZX80 (and most later MBASICs) had floating point.

    The ZX80 ran Sinclair Basic, it had nothing to do with MS and it was integer >> only. The ZX81 had flowing point basic and had an 8K ROM which is still
    bloody impressive.

    I did not realize that the ZX80 was integer only! I thought it was more
    or less like the ZX81 with everything stuffed into an asic.
    --scott


    The Apple ][ was also integer only. The Apple ][+ had floating point.
    The top 16k of memory was ROM supporting the OS and BASIC. Relatively
    roomy compared to the ZX80/81.

    pt
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 14:19:14 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of threads
    (tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different
    processes, so you had to do a fork and then synchronize with the other
    process. This wasn't a dealbreaker and we did plenty of stuff that way,
    but having threads available was very nice and made for many operations
    becoming more convenient to write.

    Unfortunately most win32 programmers don't really understand multiprocess programming because the w32 API is so borked so use threads even when seperate process would be more appropriate.



    Windows has what we need to run multi process. Even for a Mutex...
    Remember WAIT_ABANDONED?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 14:21:27 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of threads
    (tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different
    processes, so you had to do a fork and then synchronize with the other
    process. This wasn't a dealbreaker and we did plenty of stuff that way,
    but having threads available was very nice and made for many operations
    becoming more convenient to write.

    Unfortunately most win32 programmers don't really understand multiprocess programming because the w32 API is so borked so use threads even when seperate process would be more appropriate.



    What about separate multi threaded processes?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 14:22:34 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:31 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 16:41:22 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >> wrote:

    You need an OS to do threading properly too. Theres a reason green threads

    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an
    operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library but
    not a process library. Its perfectly possible to simulate a multiprocess >>>>> enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    The differences are utterly irrelevant when it comes to prividing a common API to the functionality but thank you for demonstrating you had no answer
    to my question.


    Ummm... It is relevant. Every process has a single thread of execution,
    but not all processes have multiple threads.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 14:31:49 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 9:29 AM, boltar@caprica.universe wrote:
    On Sun, 25 Oct 2026 16:15:21 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <YHpDS.27364$9b8f.4666@fx39.iad>,
    Scott Lurndal <slp53@pacbell.net> wrote:
    cross@spitfire.i.gajendra.net (Dan Cross) writes:
    In article <20261025084234.0000449c@yahoo.com>,
    Michael S <already5chosen@yahoo.com> wrote:
    <snip>
    How any of this trivia has anything to do with real-world
    implementations of C++11 threads?

    Your statement, "while in theory threads can be implemented by
    C++ compilers+language support library, in practice I had never
    seen it done" is probably strictly true: you, individually, have
    never seen it done.

    But that does not imply that it has never been done. In
    fact, it has; many times over. There are complications, but it
    can be done. That is what I was telling you, supported by
    examples.

    Although it does, generally, rely on specific operating system
    interfaces (e.g. makecontext, setcontext, et alia).

    That's true. But no one said that one can use strict ISO C++ to
    implement the C++ standard library.

    Regardless, if you can set the stack pointer, you can build a
    reasonable cooperative threading library purely in userspace,
    without the OS caring.

    Oh really? You seem to have forgotten about the program counter not to mentioning pushing and popping all the other cpu registers and flags at context
    switch.


    Make Fibers in 100% pure C++? But those are not threads. Multiple fibers
    can run on a single thread. Although, I think they can run on multiple
    threads as well. So, multiple threads, multiple fibers per thread.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From kludge@kludge@panix.com (Scott Dorsey) to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:06:16 2026
    From Newsgroup: comp.lang.c++

    Cryptoengineer <petertrei@gmail.com> wrote:

    The Apple ][ was also integer only. The Apple ][+ had floating point.
    The top 16k of memory was ROM supporting the OS and BASIC. Relatively
    roomy compared to the ZX80/81.

    Yes, the INTBASIC was Apple code, while APPLESOFT BASIC was written by Microsoft on contract to Apple. APPLESOFT worked pretty well aside from programmable functions. It could do realtime FFTs at 0.5 samp/sec which
    was good enough for some interesting things.

    You could upgrade the roms in your original Apple ][ to the ][+ roms
    for what seemed like a fortune to me at the time but which was probably
    quite reasonable. I think you lost Sweet-16 in the process though.
    --scott

    pt
    --
    "C'est un Nagra. C'est suisse, et tres, tres precis."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 16:16:26 2026
    From Newsgroup: comp.lang.c++

    On 10/22/2026 10:29 PM, Chris M. Thomasson wrote:
    On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:
    On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:

    That's why I try to use PL/I AUTOMATIC (stack) storage and not
    allocate a lot of stuff. You need to have a disciplined approach if
    you allocate random stuff here and there.

    What if yourCOre building an object that needs to be returned to the
    caller?

    Have the caller have the object before hand and call a function to initialize it?

    Even analogous, to say, an API that says read n bytes and store into
    buffer. Well, the caller has lifetime of said buffer. The caller makes
    the buffer, calls into the function. The buffer bounds are known. Say a metadata stub:

    struct foobar_caller_alloc_helper
    {
    size_t m_size;
    size_t m_align;
    };




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 17:07:39 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 4:06 PM, Scott Dorsey wrote:
    Cryptoengineer <petertrei@gmail.com> wrote:

    The Apple ][ was also integer only. The Apple ][+ had floating point.
    The top 16k of memory was ROM supporting the OS and BASIC. Relatively
    roomy compared to the ZX80/81.

    Yes, the INTBASIC was Apple code, while APPLESOFT BASIC was written by Microsoft on contract to Apple. APPLESOFT worked pretty well aside from programmable functions. It could do realtime FFTs at 0.5 samp/sec which
    was good enough for some interesting things.

    You could upgrade the roms in your original Apple ][ to the ][+ roms
    for what seemed like a fortune to me at the time but which was probably
    quite reasonable. I think you lost Sweet-16 in the process though.
    --scott

    pt



    IIGS with some extra memory, and a HD, beat a Mac back in the say, iirc,
    Mac SE. The Mac iicx, or iise, well they were pretty fun.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Rich Alderson@news@alderson.users.panix.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 20:10:26 2026
    From Newsgroup: comp.lang.c++

    Lynn McGuire <lynnmcguire5@gmail.com> writes:

    Bill Gates wrote the Microsoft Basic compiler and interpreter for the
    Altair 8080 in 2K of ram using assembly language. Take that as you will.

    The original Altair BASIC is only an interpreter; there is no compiler available.

    The interpreter requires 4K minimum to run.

    The interpreter is assembled from source on a PDP-10 with at least 128K (and preferably more) of 36 bit words,because it's implemented as local system call macros in PDP-10 assembler.

    Bill wrote the basic framework, Monte Davidoff wrote the transcendental math functions, and Paul Allen wrote the PDP-10 code to do the assembly.

    NB: I worked for Paul building Living Computers: Museum+Labs and working there as an engineer from 2003-2018, then till 2020 when we closed due to the pandemic.
    I've seen the original code, with named attributions.
    --
    Rich Alderson news@alderson.users.panix.com
    Audendum est, et veritas investiganda; quam etiamsi non assequamur,
    omnino tamen proprius, quam nunc sumus, ad eam perveniemus.
    --Galen --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 17:22:28 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:56 PM, Michael S wrote:
    On Sun, 25 Oct 2026 08:41:48 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261025011151.000038ef@yahoo.com>,
    Now, would it be the first thing I would want like addition to C++
    standard library? No it would not be.
    The first thing would be IPv4 communication, sockets, poll etc...

    POSIX has all of that. POSIX also has a process model. Why not
    just make POSIX a part of the language, then? (Answer that and
    you may start to understand why this is harder than it looks
    for C++ [and C].)

    No, it isn't. How similar do you think the posix and windows threading
    model/api are? Yet somehow C++ provides a common wrapper for both.

    Actually, implementing C++11 (or C11) threads fully in user space on pre-Vista Win32 (i.e. before addition of support for conditional
    variables to OS API) would be quite challenging. I don't know if
    anybody bothered.
    I think that it is possible, but if you want it robust then it (cond. variables) will cost you significant overhead relatively to "native" synchronization primitives.

    There is no reason the same can't be done for processes and your
    irrelevant waffle about past issues of threading on *nix don't change
    that.


    Dick-measuring competitions are integral part of Usenet tradition.







    I tried to do a little something, no atomics, but, since I am able to
    access comp.lang.c++ agai, lets see if I can find it:

    https://groups.google.com/g/comp.lang.c/c/WPH7ed5uS4Y/m/ohiP-hUWkcAJ

    Content:
    ___________________________________



    ________________________________________________________________
    #if ! defined (CT_C11_THREADS_H_EMULATION_H)
    # define CT_C11_THREADS_H_EMULATION_H 1
    # if defined (__cplusplus)
    extern "C"
    {
    # endif



    #if defined (CT_C11_THREADS_H_PRINTF_LOG)
    # include <stdio.h>
    # define CT_C11_THREADS_H_PRINTF(mp_exp) printf mp_exp
    #else
    # define CT_C11_THREADS_H_PRINTF(mp_exp) ((void)(0))
    #endif




    #include <stdlib.h>
    #include <pthread.h>
    #include <assert.h>


    typedef int (*ct_thrd_start_t) (void*);

    struct ct_thrd_user
    {
    pthread_t ptid;
    };


    struct ct_thrd_sys
    {
    ct_thrd_start_t fp_user;
    void* user_ctx;
    int user_ret;
    };


    enum ct_thrd_sys_status
    {
    ct_thrd_success = 0,
    ct_thrd_nomem = 1,
    ct_thrd_timedout = 2,
    ct_thrd_busy = 3,
    ct_thrd_error = 4
    };





    /* low-level system threading API's __________________________________________________________________*/
    static struct ct_thrd_sys*
    ct_thrd_sys_create(
    ct_thrd_start_t fp_user,
    void* user_ctx
    );

    static void
    ct_thrd_sys_destroy(
    struct ct_thrd_sys* const self
    );

    static void*
    ct_thrd_sys_entry(
    void* self_raw
    );



    struct ct_thrd_sys*
    ct_thrd_sys_create(
    ct_thrd_start_t fp_user,
    void* user_ctx
    ){
    struct ct_thrd_sys* const self = malloc(sizeof(*self));

    if (self)
    {
    self->fp_user = fp_user;
    self->user_ctx = user_ctx;
    self->user_ret = 0;
    }

    CT_C11_THREADS_H_PRINTF(("ct_thrd_sys_create = %p\r\n", (void*)self));

    return self;
    }

    void
    ct_thrd_sys_destroy(
    struct ct_thrd_sys* const self
    ){
    free(self);

    CT_C11_THREADS_H_PRINTF(
    ("ct_thrd_sys_destroy(self = %p)\r\n", (void*)self)
    );
    }


    void*
    ct_thrd_sys_entry(
    void* self_raw
    ){
    struct ct_thrd_sys* const self = self_raw;

    CT_C11_THREADS_H_PRINTF(
    ("ct_thrd_sys_entry(self_raw = %p):Enter\r\n", self_raw)
    );

    self->user_ret = self->fp_user(self->user_ctx);

    CT_C11_THREADS_H_PRINTF(
    ("ct_thrd_sys_entry(self_raw = %p):Exit = %p\r\n", self_raw,
    (void*)self)
    );

    return self;
    }






    /* C11 emulation API layer __________________________________________________________________*/


    /* Threading API ______________________________________________________________*/
    typedef struct ct_thrd_user ct_thrd_t;


    static int
    ct_thrd_create(
    ct_thrd_t* uself,
    ct_thrd_start_t fp_user,
    void* user_ctx
    );

    static int
    ct_thrd_join(
    ct_thrd_t self,
    int* user_retv
    );


    int
    ct_thrd_create(
    ct_thrd_t* uself,
    ct_thrd_start_t fp_user,
    void* user_ctx
    ){
    struct ct_thrd_sys* const self =
    ct_thrd_sys_create(fp_user, user_ctx);

    if (self)
    {
    int status = pthread_create(&uself->ptid, NULL, ct_thrd_sys_entry,
    self);

    if (! status)
    {
    return ct_thrd_success;
    }

    ct_thrd_sys_destroy(self);
    }

    return ct_thrd_nomem;
    }


    int
    ct_thrd_join(
    ct_thrd_t self,
    int* user_retv
    ){
    void* ptjret = NULL;

    pthread_join(self.ptid, &ptjret);

    if (ptjret)
    {
    struct ct_thrd_sys* const self = ptjret;

    if (user_retv)
    {
    *user_retv = self->user_ret;
    }

    ct_thrd_sys_destroy(self);

    return ct_thrd_success;
    }

    return ct_thrd_error;
    }




    /* Thread Specific Storage API ______________________________________________________________*/
    typedef pthread_key_t ct_tss_t;
    typedef void(*ct_tss_dtor_t) (void*);

    static int
    ct_tss_create(
    ct_tss_t* self,
    ct_tss_dtor_t fp_user_dtor
    );

    static void
    ct_tss_delete(
    ct_tss_t self
    );

    static int
    ct_tss_set(
    ct_tss_t self,
    void* user_ctx
    );

    #define ct_tss_get(mp_self) pthread_getspecific((mp_self))



    int
    ct_tss_create(
    ct_tss_t* self,
    ct_tss_dtor_t fp_user_dtor
    ){
    int status = pthread_key_create(self, fp_user_dtor);

    if (!status)
    {
    return ct_thrd_success;
    }

    return ct_thrd_error;
    }


    void
    ct_tss_delete(
    ct_tss_t self
    ){
    int status = pthread_key_delete(self);

    if (! status)
    {
    return;
    }

    assert(! status);
    }


    int
    ct_tss_set(
    ct_tss_t self,
    void* user_ctx
    ){
    int status = pthread_setspecific(self, user_ctx);

    if (!status)
    {
    return ct_thrd_success;
    }

    return ct_thrd_error;
    }




    /* Mutex API
    ______________________________________________________________*/
    typedef pthread_mutex_t ct_mtx_t;

    enum {
    ct_mtx_plain = 1,
    ct_mtx_recursive = 2,
    ct_mtx_timed = 4
    };


    int
    ct_mtx_init(
    ct_mtx_t* self,
    int type
    ){
    if (type == ct_mtx_plain)
    {
    int status = pthread_mutex_init(self, NULL);

    if (! status)
    {
    return ct_thrd_success;
    }
    }

    return ct_thrd_error;
    }


    void
    ct_mtx_destroy(
    ct_mtx_t* self
    ){
    int status = pthread_mutex_destroy(self);

    if (! status)
    {
    return;
    }

    assert(! status);
    }


    int
    ct_mtx_lock(
    ct_mtx_t* self
    ){
    int status = pthread_mutex_lock(self);

    if (! status)
    {
    return ct_thrd_success;
    }

    assert(! status);

    return ct_thrd_error;
    }


    int
    ct_mtx_unlock(
    ct_mtx_t* self
    ){
    int status = pthread_mutex_unlock(self);

    if (!status)
    {
    return ct_thrd_success;
    }

    assert(! status);

    return ct_thrd_error;
    }




    /* Mutex API
    ______________________________________________________________*/
    typedef pthread_cond_t ct_cnd_t;

    int
    ct_cnd_init(
    ct_cnd_t* self
    ){
    int status = pthread_cond_init(self, NULL);

    if (! status)
    {
    return ct_thrd_success;
    }

    return ct_thrd_error;
    }


    void
    ct_cnd_destroy(
    ct_cnd_t* self
    ){
    int status = pthread_cond_destroy(self);

    if (! status)
    {
    return;
    }

    assert(! status);
    }


    int
    ct_cnd_signal(
    ct_cnd_t* self
    ){
    int status = pthread_cond_signal(self);

    if (! status)
    {
    return ct_thrd_success;
    }

    assert(! status);

    return ct_thrd_error;
    }


    int
    ct_cnd_broadcast(
    ct_cnd_t* self
    ){
    int status = pthread_cond_broadcast(self);

    if (! status)
    {
    return ct_thrd_success;
    }

    assert(! status);

    return ct_thrd_error;
    }


    int
    ct_cnd_wait(
    ct_cnd_t* self,
    ct_mtx_t* mtx
    ){
    int status = pthread_cond_wait(self, mtx);

    if (! status)
    {
    return ct_thrd_success;
    }

    assert(! status);

    return ct_thrd_error;
    }






    /* Mock up the final C11 API with some macros... ;^o ______________________________________________________________*/



    /* C11 threading API
    _________________________________________________*/
    #define thrd_success ct_thrd_success
    #define thrd_nomem ct_thrd_nomem
    #define thrd_timedout ct_thrd_timedout
    #define thrd_busy ct_thrd_busy
    #define thrd_error ct_thrd_error

    #define thrd_t ct_thrd_t

    #define thrd_create ct_thrd_create
    #define thrd_join ct_thrd_join



    /* C11 thread specific storage API _________________________________________________*/
    #define tss_t ct_tss_t

    #define tss_create ct_tss_create
    #define tss_delete ct_tss_delete
    #define tss_set ct_tss_set
    #define tss_get ct_tss_get



    /* C11 mutex API
    _________________________________________________*/
    #define mtx_plain ct_mtx_plain
    #define mtx_recursive ct_mtx_recursive
    #define mtx_timed ct_mtx_timed

    #define mtx_t ct_mtx_t

    #define mtx_init ct_mtx_init
    #define mtx_destroy ct_mtx_destroy
    #define mtx_lock ct_mtx_lock
    #define mtx_unlock ct_mtx_unlock



    /* C11 condition variable API _________________________________________________*/
    #define cnd_t ct_cnd_t

    #define cnd_init ct_cnd_init
    #define cnd_destroy ct_cnd_destroy
    #define cnd_signal ct_cnd_signal
    #define cnd_broadcast ct_cnd_broadcast
    #define cnd_wait ct_cnd_wait




    # if defined (__cplusplus)
    }
    # endif
    #endif
    ________________________________________________________________



    This is in my personal coding style. I am sorry if it ends up pissing you
    off!

    ;^o




    Anyway, what do you think?

    :^)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 00:42:55 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:

    Even analogous, to say, an API that says read n bytes and store into
    buffer. Well, the caller has lifetime of said buffer. The caller makes
    the buffer, calls into the function.

    So how is the caller supposed to manage that memory?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:01:39 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:37 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bj08r$309uk$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe>
    wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe>
    wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >> wrote:

    You need an OS to do threading properly too. Theres a reason green
    threads
    in java were a joke.

    Weird that you think you need a operating system for threads,
    yet you want C to standardize processes which also ... need an >>>>>>>> operating system. I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect
    from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading library >> but
    not a process library. Its perfectly possible to simulate a multiprocess
    enviroment.

    So write a simulator in your language of choice. You don't need
    the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is? And how is it
    different from a _process_? For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    Who mentioned C? I was talking about C++ which has a threading API already. Do try and keep up.


    So does C11.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:03:01 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 1:42 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 12:17:47 -0700
    Peter Flass <Peter@Iron-Spring.com> gabbled:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>,
    <boltar@caprica.universe> wrote:
    What, pray tell, do you think that a _thread_ is?-a And how is it
    different from a _process_?-a For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    -a-a-a-a- Dan C.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    With copy-on-write process models the actual difference is a bit less
    clear cut.


    Have you ever tried to sync up multiple processes each running multiple threads? When is the last time you used a robust mutex?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:11:48 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 5:42 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:

    Even analogous, to say, an API that says read n bytes and store into
    buffer. Well, the caller has lifetime of said buffer. The caller makes
    the buffer, calls into the function.

    So how is the caller supposed to manage that memory?

    Ummm, say we wanted to have a buffer and use it.

    Say:

    {
    char buf[2048] = { '\0' };
    size_t bytes= foo_read(self, buf, 1024);
    }

    A caller provided buffer is normal with a lot of API's out there.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:21:00 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 5:42 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:

    Even analogous, to say, an API that says read n bytes and store into
    buffer. Well, the caller has lifetime of said buffer. The caller makes
    the buffer, calls into the function.

    So how is the caller supposed to manage that memory?

    Managing the memory is the callerrCOs job in C anyway. ThatrCOs the
    trade-off the language makes. read, recv, and mmap all work this way.
    This just applies the same contract to the librCOs own object.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 19:28:00 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 3:32 PM, Lawrence DrCOOliveiro wrote:
    I had a quick look at that. It seems to have to do with the reality of graphics hardware implementing different kinds of memory with
    different kinds of characteristics, and the impossibility of
    completely such ignoring such issues in real-time 3D rendering.

    I expect higher-level APIs (e.g. game engines) will wrap all this
    behind their own higher-level abstractions, so regular
    programmers/game creators donrCOt have to worry about it.

    In short, itrCOs an abstraction that leaks that you accept only because
    you have to, not because itrCOs a good idea for abstractions in general.
    If you can successfully hide issues of memory and other resource
    allocation behind your abstraction, you would still rather do it than
    not.

    So, to get back to my point, the technique I use is based on a form of structured programming called a rCLNassi-Shneiderman diagramrCY. The
    overall structure looks like

    ... initialize object pointer to NULL ...
    do /*once*/
    {
    ... possible other stuff ...
    ... allocate object pointer ...
    if (error occurred)
    break;
    ... possible other stuff using object pointer ...
    }
    while (false);
    ... call free(3) (or equivalent) on object pointer ...

    So you can see there is no way out of the inner block without passing
    through the dispose call. Using gotos would contribute nothing except
    make it harder to assure yourself of the simplicity of the control
    flow.

    Looks deceptively simple. But the same technique can scale up to quite complex cases.


    The graphics case is where the leak is unavoidable, but thatrCOs not why
    IrCOd want it. A lib that never allocates behind your back is what you
    want in embedded, kernel, and arena code, and a foo_create wrapper on
    top gives you the hidden-allocation version for everyone else. Your
    do-once cleanup idiom works fine with it. You just call deinit and
    reclaim the block the way you made it. ItrCOs a way to structure the callerrCOs error handling, and it doesnrCOt say anything about who owns the memory.

    Say memory on a threads stack, no free needed.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Cryptoengineer@petertrei@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Oct 25 22:54:14 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 7:06 PM, Scott Dorsey wrote:
    Cryptoengineer <petertrei@gmail.com> wrote:

    The Apple ][ was also integer only. The Apple ][+ had floating point.
    The top 16k of memory was ROM supporting the OS and BASIC. Relatively
    roomy compared to the ZX80/81.

    Yes, the INTBASIC was Apple code, while APPLESOFT BASIC was written by Microsoft on contract to Apple. APPLESOFT worked pretty well aside from programmable functions. It could do realtime FFTs at 0.5 samp/sec which
    was good enough for some interesting things.

    You could upgrade the roms in your original Apple ][ to the ][+ roms
    for what seemed like a fortune to me at the time but which was probably
    quite reasonable. I think you lost Sweet-16 in the process though.
    --scott

    pt

    I distinctly recall working with Sweet-16 on my ][+ back in the day,
    but can't recall the details.

    pt
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 03:39:38 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each
    one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 03:40:23 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 03:43:05 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 19:28:00 -0700, Chris M. Thomasson wrote:

    A lib that never allocates behind your back is what you
    want in embedded, kernel, and arena code ...

    Even kernels want a common memory-management architecture, so addon
    modules donrCOt have to reinvent memory management on their own.

    Think of something like allocating low-priority cache memory, for
    stuff that can be dumped if necessary: that needs to be managed in the
    core of the kernel, so that if apps need regular memory for things
    they want to keep in memory, the kernel can free up cache as necessary
    to make more memory available.

    Stop trying to rationalize away the whole point of dynamic memory
    allocation.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 03:47:40 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 22:54:14 -0400, Cryptoengineer wrote:

    I distinctly recall working with Sweet-16 on my ][+ back in the day,
    but can't recall the details.

    Interpreter for 16-bit integer arithmetic, according to <https://en.wikipedia.org/wiki/SWEET16>: ran at 1/10th the speed of
    native 6502 instructions, but took up just 300 bytes of RAM, but
    apparently cut the size of the whole Integer BASIC implementation by
    20%.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 10:01:55 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 14:19:14 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of threads >>>> (tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different
    processes, so you had to do a fork and then synchronize with the other
    process. This wasn't a dealbreaker and we did plenty of stuff that way, >>> but having threads available was very nice and made for many operations
    becoming more convenient to write.

    Unfortunately most win32 programmers don't really understand multiprocess
    programming because the w32 API is so borked so use threads even when
    seperate process would be more appropriate.



    Windows has what we need to run multi process. Even for a Mutex...
    Remember WAIT_ABANDONED?

    win32 can't do fork() making it effectively a totally useless API for
    a lot of multiprocess development. Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking off something on the command line or creating a pipe (something else win32 is shit at) but thats about it.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 10:02:41 2026
    From Newsgroup: comp.lang.c++

    On Sun, 25 Oct 2026 14:22:34 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/25/2026 1:31 AM, boltar@caprica.universe wrote:
    The differences are utterly irrelevant when it comes to prividing a common >> API to the functionality but thank you for demonstrating you had no answer >> to my question.


    Ummm... It is relevant. Every process has a single thread of execution,
    but not all processes have multiple threads.

    No shit sherlock, thanks for the heads up. Your point is?

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Titus G@noone@nowhere.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 08:43:19 2026
    From Newsgroup: comp.lang.c++

    On 27/10/2026 08:10, Blaine wrote:

    Basically that methinks you insult too much. Your wisdom here isn't
    worth a sack of beans. I haven't learned one thing from you.

    What a laugh. You are the clown replying to Starmaker.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:03:25 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
    On Sun, 25 Oct 2026 14:19:14 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass-a <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of
    threads
    (tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only different >>>> processes, so you had to do a fork and then synchronize with the other >>>> process.-a This wasn't a dealbreaker and we did plenty of stuff that
    way,
    but having threads available was very nice and made for many operations >>>> becoming more convenient to write.

    Unfortunately most win32 programmers don't really understand
    multiprocess
    programming because the w32 API is so borked so use threads even when
    seperate process would be more appropriate.



    Windows has what we need to run multi process. Even for a Mutex...
    Remember WAIT_ABANDONED?

    win32 can't do fork() making it effectively a totally useless API for a
    lot of multiprocess development.

    Afaict, its not useless.

    Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking off something
    on the command line or creating a pipe (something else win32 is shit at)
    but
    thats about it.


    Shared state? Just use memory mapped files. You don't need pipes/sockets
    etc. You need to know how to properly sync things.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:05:30 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 2:59 AM, boltar@caprica.universe wrote:
    On Sun, 25 Oct 2026 22:56:19 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 25 Oct 2026 08:41:48 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261025011151.000038ef@yahoo.com>,
    Now, would it be the first thing I would want like addition to C++
    standard library? No it would not be.
    The first thing would be IPv4 communication, sockets, poll etc...

    POSIX has all of that. POSIX also has a process model. Why not
    just make POSIX a part of the language, then? (Answer that and
    you may start to understand why this is harder than it looks
    for C++ [and C].)

    No, it isn't. How similar do you think the posix and windows threading
    model/api are? Yet somehow C++ provides a common wrapper for both.

    Actually, implementing C++11 (or C11) threads fully in user space on
    pre-Vista Win32 (i.e. before addition of support for conditional
    variables to OS API) would be quite challenging. I don't know if
    anybody bothered.
    I think that it is possible, but if you want it robust then it (cond.
    variables) will cost you significant overhead relatively to "native"
    synchronization primitives.

    C++ threading didn't have 3 level locking until 2017 making it effectively useless IMO. Perhaps that was down to the lowest common denominator called Windows.


    3 level locking? What do you mean?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:12:24 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 12:45 PM, Michael S wrote:
    On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Mon, 26 Oct 2026 14:41:54 GMT
    scott@slp53.sl.home (Scott Lurndal) gabbled:
    boltar@caprica.universe writes:
    C++ threading didn't have 3 level locking until 2017 making it
    effectively useless IMO. Perhaps that was down to the lowest common
    denominator called Windows.


    Mind defining your terminology? "3 level locking", in particular?

    If you have to ask....

    1. No lock
    2. Write lock - Read only access, writer blocked until all readers
    out of critic al section)
    3. Read-write lock - all threads other than the one in section block)


    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11. https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-writer--srw--locks
    Of course WinXP remained popular for few more years, approximately up
    until 2nd half of 2010, but that too predates publication of C++11 in 2011-09.

    This is basic stuff FFS. C++ finally got around to #2 with
    shared_mutex in 2017 and its rather critical for certain algorithms.

    Assigning a canonical "lock number" to each lock, and failing a lock
    request for a lock with a lower number than that already held is
    a design pattern that has been around since 1980 (in Burroughs
    mainframes it was implemented in hardware). Easy enough to do
    prior to C++17 in software.

    Thats something else entirely.

    And your assertion that a language that doesn't support it
    intrinsically is "useless" is ridiculous.

    Not useless then, just less useful.


    I never ever used what you call "3 level locking", not even by mistake.
    But then, I don't write complicated apps on "big" computers day in day
    out.
    Still don't really know what he means by 3 level locking. Using lock
    hashing where an address is hashed into a lock index such that no object
    needs its own lock is nothing new. But it needs to be sorted and deduped.

    (google groups wrt usenet seems to be back up now) https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/SkSqpSxGCAAJ

    some of my old relacy code:

    #include <relacy/relacy.hpp>
    #include <cstdio>
    #include <cstddef>
    #include <cstdlib>
    #include <string>
    #include <vector>

    #if ! defined (NDEBUG)
    # define CT_DBG_PRINTF(e) std::printf e
    #else
    # define CT_DBG_PRINTF(e) ((void)0)
    #endif


    #define CT_THREADS (5)
    #define CT_MUTEX_TABLE_N (64)


    struct ct_mutex_table
    {
    rl::mutex m_mutexs[CT_MUTEX_TABLE_N];

    std::size_t
    hash_ptr(
    void* p
    ) const {
    return rl::hash_ptr(p, CT_MUTEX_TABLE_N);
    }
    };


    struct ct_thread_mutex_hash
    {
    std::vector<std::size_t> m_hashed_idxs;

    // must be before any locks!
    void finalize()
    {
    std::sort(
    m_hashed_idxs.begin(),
    m_hashed_idxs.end());

    m_hashed_idxs.erase(
    std::unique(
    m_hashed_idxs.begin(),
    m_hashed_idxs.end()),
    m_hashed_idxs.end());
    }


    // BEFORE WE CALL, WE NEED TO sort and dedup before this.
    void
    lock(
    ct_mutex_table& mutex_table
    ) {
    for (auto& mtx_idx : m_hashed_idxs)
    {
    rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
    mtx.lock($);
    }
    }

    // does not really even need to be reversed...
    void
    unlock(
    ct_mutex_table& mutex_table
    ) {
    for (auto& mtx_idx : m_hashed_idxs)
    {
    rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
    mtx.unlock($);
    }
    }
    };


    struct ct_state
    {
    ct_mutex_table m_mutex_table;
    VAR_T(int) m_var_0 = 0;
    VAR_T(int) m_var_1 = 1;
    VAR_T(int) m_var_2 = 2;


    void worker_thread_a()
    {
    ct_thread_mutex_hash self_hash;

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_0));

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_1));

    self_hash.finalize();

    self_hash.lock(m_mutex_table);

    VAR(m_var_0) = 42;
    VAR(m_var_1) = 128;

    self_hash.unlock(m_mutex_table);
    }

    void worker_thread_b()
    {
    ct_thread_mutex_hash self_hash;

    // Seed!
    {
    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_1));

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_0));
    }


    // Okay... Finalize it...
    {
    self_hash.finalize();
    }


    // Finally, we can lock the bastard!
    {
    self_hash.lock(m_mutex_table);

    {
    VAR(m_var_0) = 99;
    VAR(m_var_1) = 77;
    }

    self_hash.unlock(m_mutex_table);
    }
    }
    };


    struct ct_multex_relacy_test_v000
    : rl::test_suite<ct_multex_relacy_test_v000, CT_THREADS>
    {
    ct_state m_state = { };

    void before()
    {
    // not sure to init m_state here. Is it already init?
    }

    void
    thread(
    unsigned tidx
    ) {
    if (tidx == 0)
    m_state.worker_thread_a();
    else
    m_state.worker_thread_b();
    }
    };


    int main(int argc, char** argv)
    {
    {
    rl::test_params p;

    p.iteration_count = argc > 1 ? (unsigned)atoi(argv[1]) : 100000;
    p.execution_depth_limit = 100000;

    if (argc > 2) {
    std::string m = argv[2];
    if (m == "full") p.search_type = rl::sched_full;
    else if (m == "bound") { p.search_type = rl::sched_bound; p.context_bound = argc > 3 ? atoi(argv[3]) : 2; }
    }

    rl::simulate<ct_multex_relacy_test_v000>(p);
    }

    return 0;
    }


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:20:39 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 3:02 AM, boltar@caprica.universe wrote:
    On Sun, 25 Oct 2026 14:22:34 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/25/2026 1:31 AM, boltar@caprica.universe wrote:
    The differences are utterly irrelevant when it comes to prividing a
    common
    API to the functionality but thank you for demonstrating you had no
    answer
    to my question.


    Ummm... It is relevant. Every process has a single thread of
    execution, but not all processes have multiple threads.

    No shit sherlock, thanks for the heads up. Your point is?


    My point is that you seem to be daft on these issues. Are you trolling?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:23:59 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:43 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:28:00 -0700, Chris M. Thomasson wrote:

    A lib that never allocates behind your back is what you
    want in embedded, kernel, and arena code ...

    Even kernels want a common memory-management architecture, so addon
    modules donrCOt have to reinvent memory management on their own.

    Think of something like allocating low-priority cache memory, for
    stuff that can be dumped if necessary: that needs to be managed in the
    core of the kernel, so that if apps need regular memory for things
    they want to keep in memory, the kernel can free up cache as necessary
    to make more memory available.

    Stop trying to rationalize away the whole point of dynamic memory
    allocation.

    If you need dynamic memory fine. If a lib allocates things for itself,
    fine. Just make sure to know how to clean it up. Also, the caller can
    use dynamic memory if it wants to. RAII is pretty nice here.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:26:38 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:39 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each
    one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:29:05 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?

    Yes. The caller calls malloc, if it succeeded, the caller needs to free
    what it got... Right?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:33:37 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 1:29 PM, Chris M. Thomasson wrote:
    On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?

    Yes. The caller calls malloc, if it succeeded, the caller needs to free
    what it got... Right?

    Say a lib that has foo_create... Well, the damn called must remember to
    call foo_destroy, right?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 13:44:09 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 1:40 PM, Michael S wrote:
    On Mon, 26 Oct 2026 13:12:24 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:

    On 10/26/2026 12:45 PM, Michael S wrote:
    On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Mon, 26 Oct 2026 14:41:54 GMT
    scott@slp53.sl.home (Scott Lurndal) gabbled:
    boltar@caprica.universe writes:
    C++ threading didn't have 3 level locking until 2017 making it
    effectively useless IMO. Perhaps that was down to the lowest
    common denominator called Windows.


    Mind defining your terminology? "3 level locking", in
    particular?

    If you have to ask....

    1. No lock
    2. Write lock - Read only access, writer blocked until all readers
    out of critic al section)
    3. Read-write lock - all threads other than the one in section
    block)

    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11.
    https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-writer--srw--locks
    Of course WinXP remained popular for few more years, approximately
    up until 2nd half of 2010, but that too predates publication of
    C++11 in 2011-09.

    This is basic stuff FFS. C++ finally got around to #2 with
    shared_mutex in 2017 and its rather critical for certain
    algorithms.
    Assigning a canonical "lock number" to each lock, and failing a
    lock request for a lock with a lower number than that already
    held is a design pattern that has been around since 1980 (in
    Burroughs mainframes it was implemented in hardware). Easy
    enough to do prior to C++17 in software.

    Thats something else entirely.

    And your assertion that a language that doesn't support it
    intrinsically is "useless" is ridiculous.

    Not useless then, just less useful.


    I never ever used what you call "3 level locking", not even by
    mistake. But then, I don't write complicated apps on "big"
    computers day in day out.
    Still don't really know what he means by 3 level locking. Using lock
    hashing where an address is hashed into a lock index such that no
    object needs its own lock is nothing new. But it needs to be sorted
    and deduped.


    He explained it in the post above.
    It seem that he mistyped few things in explanation, but it is possible
    to understand intentions. He is talking about std::shared_mutex.

    Ahhh! I call that a read/write mutex. Okay.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 22:29:22 2026
    From Newsgroup: comp.lang.c++

    On 26/10/2026 21:29, Chris M. Thomasson wrote:
    On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?

    Yes. The caller calls malloc, if it succeeded, the caller needs to free
    what it got... Right?

    Exactly. The caller is responsible for /managing/ the memory (or it can
    pass on that responsibility to something else). malloc and free are
    provide and dispose of memory, they do not manage it.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 21:45:20 2026
    From Newsgroup: comp.lang.c++

    On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:

    Say a lib that has foo_create... Well, the damn called must remember
    to call foo_destroy, right?

    Are you backpedalling from your previous idea that the caller must
    allocate the memory for the library to use?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 21:45:54 2026
    From Newsgroup: comp.lang.c++

    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 21:46:30 2026
    From Newsgroup: comp.lang.c++

    On Mon, 26 Oct 2026 13:23:59 -0700, Chris M. Thomasson wrote:

    If you need dynamic memory fine.

    What the hell do you think we have been talking about this whole
    time??
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 14:47:07 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    Ummm... What we were talking about. You snipped a lot. See, the caller
    needs to have the buffer in order to call fread, right?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 14:51:57 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 2:46 PM, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:23:59 -0700, Chris M. Thomasson wrote:

    If you need dynamic memory fine.

    What the hell do you think we have been talking about this whole
    time??

    Why do you "seem" to think we "always" need dynamic memory? Then you ask
    this gem:
    __________
    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?
    __________

    See, the caller is responsible for managing things. Say foo_create that succeeds. Well, now the caller must call foo_destroy.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 14:53:48 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:

    Say a lib that has foo_create... Well, the damn called must remember
    to call foo_destroy, right?

    Are you backpedalling from your previous idea that the caller must
    allocate the memory for the library to use?

    Where did I say must? I said some libs allow the caller to create their internal state. You are the one that seems to not understand it? Either
    way, the caller needs to manage things in C. malloc/free, etc.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 14:58:35 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 2:29 PM, David Brown wrote:
    On 26/10/2026 21:29, Chris M. Thomasson wrote:
    On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?

    Yes. The caller calls malloc, if it succeeded, the caller needs to
    free what it got... Right?

    Exactly.-a The caller is responsible for /managing/ the memory (or it can pass on that responsibility to something else).-a malloc and free are provide and dispose of memory, they do not manage it.


    Right. For instance take my ralloc thing. A user can create a big pile
    of memory, have rallocex carve it up for them (align, etc), and use it.
    But, the user needs to know how to free that memory. If its on the
    stack, well, easy. If not call free, or whatever it needs.

    ralloc does not give a crap where the memory came from.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lynn McGuire@lynnmcguire5@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 17:08:58 2026
    From Newsgroup: comp.lang.c++

    On 10/23/2026 11:06 AM, Peter Flass wrote:
    On 10/23/26 01:01, boltar@caprica.universe wrote:
    On Thu, 22 Oct 2026 12:19:49 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bd7tj$rh4f$1@dont-email.me>,-a <boltar@battlestar.co.uk>
    wrote:

    Most of us have a CS degree. But then we go out into the real world,
    get a
    job and find out what real programming on real products entails, not
    a load
    of virtual academic naval gazing.

    That's because it's not a trade school degree.-a It's not there to teach >>> you to program, it's there to teach you the fundamentals that you
    need to
    properly understand programming.

    No, it teaches you fundamentals of certain aspects of computer
    paradigms such
    as databases, graphics, AI. Most people into computers learn actual
    programming
    long before they hit university.

    Engineering schools are even more that way.-a They don't teach you much
    engineering, but they give you all the background that you need to learn >>> engineering.

    Programming isn't pure engineering - its a combination of engineering,
    logic,
    art and a trade.

    If you just want a job, getting one of these degrees is not for you.
    It's
    not there for that.

    Bill Gates never earned a degree. He seemed to do ok.

    From what I understand, he wasn't a very good programmer, though.

    https://www.joelonsoftware.com/2006/06/16/my-first-billg-review/

    "Then I sat down to write the Excel Basic spec, a huge document that
    grew to hundreds of pages. I think it was 500 pages by the time it was
    done. (rCLWaterfall,rCY you snicker; yeah yeah shut up.)"

    "In my BillG review meeting, the whole reporting hierarchy was there,
    along with their cousins, sisters, and aunts, and a person who came
    along from my team whose whole job during the meeting was to keep an
    accurate count of how many times Bill said the F word. The lower the f***-count, the better."

    "rCa and THERE WERE NOTES IN ALL THE MARGINS. ON EVERY PAGE OF THE SPEC.
    HE HAD READ THE WHOLE GODDAMNED THING AND WRITTEN NOTES IN THE MARGINS."

    He Read The Whole Thing! [OMG SQUEEE!]

    I turned down an unsolicited job at Microsoft in 1987. In retrospect,
    it may have been a bad decision. Then again, BillG seems to be a crazy overseer from the latest reports.

    Lynn

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 22:20:23 2026
    From Newsgroup: comp.lang.c++

    On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:

    On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:

    On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:

    Say a lib that has foo_create... Well, the damn called must
    remember to call foo_destroy, right?

    Are you backpedalling from your previous idea that the caller must
    allocate the memory for the library to use?

    Where did I say must?

    You said rCLManaging the memory is the callerrCOs job in C anyway.rCY You didnrCOt say rCLcould be the callerrCOs jobrCY as in rCLthe caller could have a choicerCY, you said rCL*is* the callerrCOs jobrCY. No choice. I.e. the caller *must* manage memory.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 15:42:31 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 3:20 PM, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:

    On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:

    On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:

    Say a lib that has foo_create... Well, the damn called must
    remember to call foo_destroy, right?

    Are you backpedalling from your previous idea that the caller must
    allocate the memory for the library to use?

    Where did I say must?

    You said rCLManaging the memory is the callerrCOs job in C anyway.rCY You didnrCOt say rCLcould be the callerrCOs jobrCY as in rCLthe caller could have a
    choicerCY, you said rCL*is* the callerrCOs jobrCY. No choice. I.e. the caller *must* manage memory.

    But, the caller must take care in C. Say a lib that allows the caller to create their own memory from the requirements reaped from the lib. Okay.
    Fine. Also, take a lib that is more "encapsulated" than say a pure foo_create/destroy. The caller must remember to call foo_destroy, right?

    Using io_uring is a fun one. The caller created the memory, iirc from
    mmap, so the kernel can use it. The Kernel punts off the lifetime
    management of the users ring buffers.

    The C must manage things regardless. say malloc and free?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 15:46:04 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:

    Managing the memory is the callerrCOs job in C anyway.

    Does that apply to the caller of library APIs like malloc(3) and
    free(3)?

    you should print that out and frame it.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 16:06:08 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 3:20 PM, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:

    On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:

    On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:

    Say a lib that has foo_create... Well, the damn called must
    remember to call foo_destroy, right?

    Are you backpedalling from your previous idea that the caller must
    allocate the memory for the library to use?

    Where did I say must?

    You said rCLManaging the memory is the callerrCOs job in C anyway.rCY You didnrCOt say rCLcould be the callerrCOs jobrCY as in rCLthe caller could have a
    choicerCY, you said rCL*is* the callerrCOs jobrCY. No choice. I.e. the caller *must* manage memory.

    A simple pattern... Now, some libs can do it others are simply not
    designed that way.


    foo_alloc_req r = foo_query_alloc(&cfg);
    void *mem = aligned_alloc(r.align, r.size); /* once */

    for (int i = 0; i < n_jobs; ++i) {
    foo *f = foo_init(mem, r.size, &cfg); /* build in the same
    block */
    /* ... use f ... */
    foo_deinit(f); /* object ends, block
    stays ours */
    }

    free(mem); /* once, at the very end */ --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 19:20:20 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 8:56 AM, Scott Lurndal wrote:
    Michael S <already5chosen@yahoo.com> writes:
    On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) wrote:



    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    - Dan C.


    First, he was talking about C++. Unlike me, he does not appear to care
    about C.
    Second, while in theory threads can be implemented by C++
    compilers+language support library, in practice I had never seen it
    done. All I had seen is C++ threads implemented in library as thin
    wrapper atop of the OS (or RT executive) implementation.
    I can not see while the same can't be done for processes, with
    API modeled on posix_spawn() or Windows CreateProcess().
    It does not look like variety in this field is bigger than in case of
    threads. More like it is smaller.

    Now, would it be the first thing I would want like addition to C++
    standard library? No it would not be.
    The first thing would be IPv4 communication, sockets, poll etc...

    For which we, thankfully, have POSIX on most non-windows operating
    systems.

    POSIC, bow down, even way before C11. It still can be used, and is very
    nice.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 19:29:29 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 3:43 AM, David Brown wrote:
    On 23/10/2026 18:57, Peter Flass wrote:
    On 10/23/26 02:45, David Brown wrote:
    On 23/10/2026 08:25, Lawrence DrCOOliveiro wrote:
    On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:

    On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:

    On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:

    That's why I try to use PL/I AUTOMATIC (stack) storage and not
    allocate a lot of stuff. You need to have a disciplined approach >>>>>>> if you allocate random stuff here and there.

    What if yourCOre building an object that needs to be returned to the >>>>>> caller?

    Have the caller have the object before hand and call a function to
    initialize it?

    IrCOm assuming that all that BASIC programming hasnrCOt got to your head, >>>> and yourCOre not serious. ;)

    Chris' wording is perhaps poor, but the principle is right.

    I don't know PL/I or Fortran, but in C if you have :

    -a-a-a-a-atypedef struct data_struct { int a; int xs[20]; } S ;

    -a-a-a-a-aS build_some_data(void) {
    -a-a-a-a-a-a-a-a S s;

    -a-a-a-a-a-a-a-a s.a = 123;
    -a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) s.xs[i] = i;

    -a-a-a-a-a-a-a-a return s;
    -a-a-a-a-a}

    -a-a-a-a-avoid foo() {
    -a-a-a-a-a-a-a-a S s = build_some_data();
    -a-a-a-a-a}


    then it is typically handled as though you had written :

    -a-a-a-a-avoid build_some_data(S * p) {
    -a-a-a-a-a-a-a-a p->a = 123;
    -a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) p->xs[i] = i;

    -a-a-a-a-a-a-a-a return;
    -a-a-a-a-a}

    -a-a-a-a-avoid foo() {
    -a-a-a-a-a-a-a-a S s;
    -a-a-a-a-a-a-a-a build_some_data(&s);
    -a-a-a-a-a}


    That is - the caller creates the /space/ for the returned object, but
    does not do any kind of initialisation.-a It passes a pointer to that
    space as a hidden parameter to the function that wants to return the
    object.

    That principle should work fine in any language, as long as the size
    of the returned object is known by the caller code.

    That last sentence is why it would not work fine,

    OK.-a Knowing the size of the returned object is an absolute requirement
    for pre-allocation by the caller, and it is a requirement that is fine
    for a lot of situations and a lot of languages.-a But if it is not the
    case for PL/I, Fortran, or any other particular language (or particular function in any language), then I fully agree - the object's space can't
    be handled by the caller.


    Use when the API provides it, or else, well, read the api learn and know
    how to use it. If it allows the caller to make the memory it needs, so
    be it, if not, who cares?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 19:57:22 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 3:32 PM, Lawrence DrCOOliveiro wrote:
    On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:

    Or what about miniaudiorCOs ma_engine_get_heap_size plus
    ma_engine_init_preallocated

    No idea about that, but the same principle would apply.

    You sound like you never worked with any of it before?????
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 20:09:48 2026
    From Newsgroup: comp.lang.c++

    On 10/24/2026 3:32 PM, Lawrence DrCOOliveiro wrote:
    On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:

    Or what about miniaudiorCOs ma_engine_get_heap_size plus
    ma_engine_init_preallocated

    No idea about that, but the same principle would apply.

    Sure you do, or what are you writing about anyway? Really?

    You seem like the oracle, right?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 20:16:52 2026
    From Newsgroup: comp.lang.c++

    On 10/26/2026 1:09 PM, Michael S wrote:
    On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 25 Oct 2026 14:19:14 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
    kludge@panix.com (Scott Dorsey) gabbled:
    In article <11bif5s$2pam0$1@dont-email.me>,
    Peter Flass <Peter@Iron-Spring.com> wrote:
    You can have co-operative threads. IBM CICS used to run lots of
    threads (tasks) concurrently, and ran them well.

    When I learned C, there was no threading and there were only
    different processes, so you had to do a fork and then synchronize
    with the other process. This wasn't a dealbreaker and we did
    plenty of stuff that way, but having threads available was very
    nice and made for many operations becoming more convenient to
    write.

    Unfortunately most win32 programmers don't really understand
    multiprocess programming because the w32 API is so borked so use
    threads even when seperate process would be more appropriate.



    Windows has what we need to run multi process. Even for a Mutex...
    Remember WAIT_ABANDONED?

    win32 can't do fork() making it effectively a totally useless API for
    a lot of multiprocess development. Creating a brand new process is
    fine if you don't need any complicated shared state such as when
    kicking off something on the command line or creating a pipe
    (something else win32 is shit at) but thats about it.


    You are clueless about Windows. That's o.k.
    Your pretense that you know something about it is not o.k.
    In that regard you are not better than LDO.
    Seems so! Damn it.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Oct 26 20:44:49 2026
    From Newsgroup: comp.lang.c++

    On 10/25/2026 2:45 AM, David Brown wrote:
    On 25/10/2026 00:11, Michael S wrote:
    On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) wrote:

    In article <11bj08r$309uk$1@dont-email.me>,
    Peter Flass-a <Peter@Iron-Spring.com> wrote:
    On 10/24/26 09:41, Dan Cross wrote:
    In article <11bhppd$2lpkc$1@dont-email.me>,
    <boltar@caprica.universe> wrote:
    On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bf4d1$skul$1@dont-email.me>,
    <boltar@caprica.universe> wrote:
    On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <11bd7rg$2cvfs$1@dont-email.me>,
    <boltar@battlestar.co.uk> wrote:
    You need an OS to do threading properly too. Theres a reason >>>>>>>>>> green threads in java were a joke.

    Weird that you think you need a operating system for threads, >>>>>>>>> yet you want C to standardize processes which also ... need an >>>>>>>>> operating system.-a I mean, POSIX already does an ok job of
    standardizing the sorts of process-y things you would expect >>>>>>>>> from, you know, an operating system.

    I'm simply pointing out the inconsistency in having a threading >>>>>>>> library but not a process library. Its perfectly possible to
    simulate a multiprocess enviroment.

    So write a simulator in your language of choice.-a You don't need >>>>>>> the language to standardize a process model for that.

    Ditto threads. So why does C++ have a threading library?

    Take your time...

    What, pray tell, do you think that a _thread_ is?-a And how is it
    different from a _process_?-a For that matter, what do you think
    that a _process_ is?

    Please, take all the time you need to answer.

    Threads share resources such as address space, files, etc. A process
    runs in its own address space. (at least these days, before virtual
    memory, who knows?)

    Indeed, but I'm hoping Mr Boltar will chime in with his answers,
    so that we can understand why thinks that a language like C
    should introduce a *process* model, and how threads are similar.

    -a-a-a-a- Dan C.


    First, he was talking about C++. Unlike me, he does not appear to care
    about C.
    Second, while in theory threads can be implemented by C++
    compilers+language-a support library, in practice I had never seen it
    done. All I had seen is C++ threads implemented in library as thin
    wrapper atop of the OS (or RT executive) implementation.
    I can not see while the same can't be done for processes, with
    API modeled on posix_spawn() or Windows CreateProcess().
    It does not look like variety in this field is bigger than in case of
    threads. More like it is smaller.


    No one is suggesting that the threads themselves are implemented in
    pure, standard, portable C++.-a You need an underlying OS or support of
    some sort if you are going to have preemptable threads.-a It's the same principle as IO and file access.

    But the difference between threads and processes is very simple from the viewpoint of C and C++.-a Suppose you have a global (i.e., external
    linkage) variable :

    -a-a-a-aint x;

    Two threads that have "int a = x;" see the same "x" (ignoring data races
    and synchronisation).-a Two processes see completely different "x".[...]

    Bingo. So, trying to imply that system is something okay for multi
    process, well, good luck. Daft. C/C++ has no std way to deal with multi process. But, we can use C/C++ to program for it all day long. Interesting.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Brown@david.brown@hesbynett.no to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 09:06:26 2026
    From Newsgroup: comp.lang.c++

    On 27/10/2026 04:44, Chris M. Thomasson wrote:
    On 10/25/2026 2:45 AM, David Brown wrote:

    No one is suggesting that the threads themselves are implemented in
    pure, standard, portable C++.-a You need an underlying OS or support of
    some sort if you are going to have preemptable threads.-a It's the same
    principle as IO and file access.

    But the difference between threads and processes is very simple from
    the viewpoint of C and C++.-a Suppose you have a global (i.e., external
    linkage) variable :

    -a-a-a-a-aint x;

    Two threads that have "int a = x;" see the same "x" (ignoring data
    races and synchronisation).-a Two processes see completely different
    "x".[...]

    Bingo. So, trying to imply that system is something okay for multi
    process, well, good luck. Daft. C/C++ has no std way to deal with multi process. But, we can use C/C++ to program for it all day long. Interesting.

    There are, of course, languages and runtime systems that handle
    processes too. An obvious example is Python. But it does it using a significantly "thicker" abstraction layer, combined with a significant run-time system to manage it all. And as a programmer, you have to be
    aware that you can't access global data from different processes, in the
    way you can do from different threads - you can only use data that is explicitly shared, or of appropriate data structures (like the
    process-aware queues). Behind the scenes, there is a lot of work to
    pass and synchronise all this using named pipes, memmapped shared files,
    etc. While C++ programmers are used to there being a certain degree of "hidden work" (unlike in C, where work is much more explicit), this kind
    of thing is not at all a match for the C++ philosophy.

    And there are languages like Erlang that divide everything into micro-processes, and use the same mechanisms for controlling and passing
    data around regardless of whether this little processes are in the same thread, or different threads, different OS processes, or different
    computers. That works because there are very narrow and tightly
    controlled mechanisms for sharing data.

    Note that these are both languages that run on a VM, not compiled languages.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 11:00:08 2026
    From Newsgroup: comp.lang.c++

    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
    [restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>> solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each
    one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..If that isn't your actual opinion of fread(),
    your comments need to be at least a little more nuanced to avoid
    applying to fread().
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 09:41:16 2026
    From Newsgroup: comp.lang.c++

    On 10/27/26 08:00, James Kuyper wrote:
    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
    [restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>>> solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each >>>> one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..If that isn't your actual opinion of fread(),
    your comments need to be at least a little more nuanced to avoid
    applying to fread().

    The difference is that the size of the buffer for fread() is the maximum
    you want/expect to read. The size of an object is the size it is, not necessarily what you expect. If you don't provide enough space you will truncate.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 18:36:48 2026
    From Newsgroup: comp.lang.c++

    Peter Flass <Peter@Iron-Spring.com> writes:
    On 10/27/26 08:00, James Kuyper wrote:
    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
    [restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>>>> solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each >>>>> one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous
    comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..If that isn't your actual opinion of fread(),
    your comments need to be at least a little more nuanced to avoid
    applying to fread().

    The difference is that the size of the buffer for fread() is the maximum
    you want/expect to read. The size of an object is the size it is, not >necessarily what you expect. If you don't provide enough space you will >truncate.

    Which isn't a significant issue with fread, since the underlying stdio
    buffer (or kernel file cache or terminal driver buffer) will hold the
    unread information for the next call to fread.

    fread(3) is basically obsolete for most high-performance applications
    which map the file directly into the process address space (mmap).
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 22:22:12 2026
    From Newsgroup: comp.lang.c++

    On Tue, 27 Oct 2026 11:00:08 -0400, James Kuyper wrote:

    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:

    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:

    On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:

    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway:
    instead of solving the resource-allocation problem once and for
    all in the library API, you are pushing the burden onto all the
    client code, each one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..

    Not even paying attention to whatrCOs being said in the parts you
    quoted, never mind the parts you didnrCOt. Note my remark above about rCLsolving the resource allocation problemrCY; elsewhere I asked: rCLWhat if yourCOre building an object that needs to be returned to the caller?rCY

    Not clear yet what werCOre talking about here? WerCOre not talking about
    random API calls, werCOre talking about libraries that need to create
    and manage abstract objects that encapsulate the function they are
    providing!
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 21:35:09 2026
    From Newsgroup: comp.lang.c++

    Thanks to my killfile, I don't see messages posted by Chris M.
    Thomasson, just other people's responses to them.

    On 2026-10-25 20:42, Lawrence DrCOOliveiro wrote:
    On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:

    Even analogous, to say, an API that says read n bytes and store into
    buffer. Well, the caller has lifetime of said buffer. The caller makes
    the buffer, calls into the function.

    So how is the caller supposed to manage that memory?

    That's the oldest message I can find on this sub-thread, and also the
    very last message I can find preceding the one quoted below, and it's
    clearly describing an fread()-like interface, not a function that
    returns objects of sizes unknown to the caller. If the messages I don't
    see gave some other context to this sub-thread, I had no way of knowing
    about it.

    On 2026-10-27 18:22, Lawrence DrCOOliveiro wrote:
    On Tue, 27 Oct 2026 11:00:08 -0400, James Kuyper wrote:

    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:

    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:

    On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:

    On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there.

    No it isnrCOt. ItrCOs not a good way to manage things, anyway:
    instead of solving the resource-allocation problem once and for
    all in the library API, you are pushing the burden onto all the
    client code, each one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous
    comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..

    Not even paying attention to whatrCOs being said in the parts you
    quoted, never mind the parts you didnrCOt. Note my remark above about rCLsolving the resource allocation problemrCY; elsewhere I asked: rCLWhat if yourCOre building an object that needs to be returned to the caller?rCY

    Yes, and without the context that applies elsewhere, your comment about resource allocation comes off as a non-sequitur.
    Not clear yet what werCOre talking about here? WerCOre not talking about random API calls, werCOre talking about libraries that need to create
    and manage abstract objects that encapsulate the function they are
    providing!

    I can find no mention of that topic anywhere on this sub-thread. It
    might be in the parts of Chris's messages that I didn't see and you
    didn't quote.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 01:43:55 2026
    From Newsgroup: comp.lang.c++

    On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:

    ... without the context that applies elsewhere, your comment about
    resource allocation comes off as a non-sequitur.

    ThatrCOs just an excuse. Other comments of mine, from further back in
    this particular line of this thread:

    * rCLWhat if yourCOre building an object that needs to be returned to the
    caller?rCY
    * rCLThe principle applies to Fortran as it does to any language where
    you have to explicitly manage storage allocations.rCY
    * rCLIf you have to do cleanup at each level before exiting, then it works
    perfectly well.rCY

    Did you notice any of that?

    From elsewhere in the discussion:

    I find the C code I write tends to do a lot of dynamic resource
    allocations. These can sometimes fail with errors. So error
    recovery will invariably involve cleaning up those parts of the
    allocations which already succeeded. Gotos are no good for this;
    you need to exit levels of structure nesting one by one, disposing
    of allocations as you go.

    I put together an example here
    <https://gitlab.com/ldo/a_structured_discipline_of_programming>.
    This is an extension module that offers services to Python code,
    because that is just about the worst example I could think of, for
    those who think gotos can cut it.

    Did you pay attention to any of that?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 22:18:54 2026
    From Newsgroup: comp.lang.c++

    On 2026-10-27 21:43, Lawrence DrCOOliveiro wrote:
    On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:

    ... without the context that applies elsewhere, your comment about
    resource allocation comes off as a non-sequitur.

    ThatrCOs just an excuse. Other comments of mine, from further back in
    this particular line of this thread:

    * rCLWhat if yourCOre building an object that needs to be returned to the
    caller?rCY
    * rCLThe principle applies to Fortran as it does to any language where
    you have to explicitly manage storage allocations.rCY
    * rCLIf you have to do cleanup at each level before exiting, then it works
    perfectly well.rCY

    Did you notice any of that?
    No, none of those comments appear anywhere in this sub-thread as
    displayed by Thunderbird. How do they fit in to the sequence of messages
    that lead to this one? If they appeared in some other sub-thread, that's
    not relevant; the fact that something is being discussed in another
    sub-thread doesn't make it relevant to what's being discussed in this
    one. However, if those comments occur in Chris' text that I never saw,
    or in messages on this sub-thread that are prior to the earliest one I
    quoted, then they would be relevant.
    The references for the oldest message I quoted indicate that there were
    20 previous ones in that sub-thread, but they don't display as
    predecessors of that message. This is a common problem when I filter out
    all the messages posted by someone. If that person is a significant
    contributor to a particular thread, that thread gets chopped up into
    pieces and Thunderbird fails to notice that those pieces are related to
    each other.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Oct 27 19:28:47 2026
    From Newsgroup: comp.lang.c++

    On 10/27/26 18:43, Lawrence DrCOOliveiro wrote:
    On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:

    ... without the context that applies elsewhere, your comment about
    resource allocation comes off as a non-sequitur.

    ThatrCOs just an excuse. Other comments of mine, from further back in
    this particular line of this thread:

    * rCLWhat if yourCOre building an object that needs to be returned to the
    caller?rCY
    * rCLThe principle applies to Fortran as it does to any language where
    you have to explicitly manage storage allocations.rCY
    * rCLIf you have to do cleanup at each level before exiting, then it works
    perfectly well.rCY

    Did you notice any of that?

    From elsewhere in the discussion:

    I find the C code I write tends to do a lot of dynamic resource
    allocations. These can sometimes fail with errors. So error
    recovery will invariably involve cleaning up those parts of the
    allocations which already succeeded. Gotos are no good for this;
    you need to exit levels of structure nesting one by one, disposing
    of allocations as you go.

    I put together an example here
    <https://gitlab.com/ldo/a_structured_discipline_of_programming>.
    This is an extension module that offers services to Python code,
    because that is just about the worst example I could think of, for
    those who think gotos can cut it.

    Did you pay attention to any of that?

    You could keep track of the allocations in a list (or whatever) and then
    walk thru and clean them up at once.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 09:01:15 2026
    From Newsgroup: comp.lang.c++

    On Mon, 26 Oct 2026 13:03:25 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
    Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking off
    something
    on the command line or creating a pipe (something else win32 is shit at)
    but
    thats about it.


    Shared state? Just use memory mapped files. You don't need pipes/sockets >etc. You need to know how to properly sync things.

    Oh really? So you receive an incoming connection to a socket via an accept() call. In unix you can fork() at that point so the connecting client has a server process all to itself with all the state instantly copied from the parent process. HOw do you mimic that in windows? Start the server process
    from scratch and pass it a ton of state via the command line or using some roll-your-own shared memory nonsense? Give me a break. I guess in windows it spawns a thread leading to the issue of a single thread crashing bringing down the entire application - something multiprocess completely avoids.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 14:04:02 2026
    From Newsgroup: comp.lang.c++

    On 10/28/2026 2:01 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 13:03:25 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
    Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking off
    something
    on the command line or creating a pipe (something else win32 is shit
    at) but
    thats about it.


    Shared state? Just use memory mapped files. You don't need pipes/
    sockets etc. You need to know how to properly sync things.

    Oh really? So you receive an incoming connection to a socket via an
    accept()
    call. In unix you can fork() at that point so the connecting client has a server process all to itself with all the state instantly copied from the parent process. HOw do you mimic that in windows? Start the server process from scratch and pass it a ton of state via the command line or using some roll-your-own shared memory nonsense? Give me a break. I guess in
    windows it
    spawns a thread leading to the issue of a single thread crashing
    bringing down
    the entire application - something multiprocess completely avoids.


    On Windows? Get used to

    https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsaduplicatesocketa

    DuplicateHandle

    etc...

    You can have multiple multi threaded processes on windows. Even ones
    with multiple fibers running on the multiple threads per process.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 14:05:34 2026
    From Newsgroup: comp.lang.c++

    On 10/28/2026 1:58 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 21:45:17 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Mon, 26 Oct 2026 14:41:54 GMT
    scott@slp53.sl.home (Scott Lurndal) gabbled:
    boltar@caprica.universe writes:
    C++ threading didn't have 3 level locking until 2017 making it
    effectively useless IMO. Perhaps that was down to the lowest common
    denominator called Windows.


    Mind defining your terminology? "3 level locking", in particular?

    If you have to ask....

    1. No lock
    2. Write lock - Read only access, writer blocked until all readers
    out of critic al section)
    3. Read-write lock - all threads other than the one in section block)


    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11.

    And unix got pthreads in 1995. Windows a decade late as usual.

    Not useless then, just less useful.


    I never ever used what you call "3 level locking", not even by mistake.
    But then, I don't write complicated apps on "big" computers day in day
    out.

    Fine, most people will never use it, but for certain things its vital.


    Its simple, if you don't like windows, do use the damn pile.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 14:06:09 2026
    From Newsgroup: comp.lang.c++

    On 10/28/2026 2:05 PM, Chris M. Thomasson wrote:
    On 10/28/2026 1:58 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 21:45:17 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Mon, 26 Oct 2026 14:41:54 GMT
    scott@slp53.sl.home (Scott Lurndal) gabbled:
    boltar@caprica.universe writes:
    C++ threading didn't have 3 level locking until 2017 making it
    effectively useless IMO. Perhaps that was down to the lowest common >>>>>> denominator called Windows.

    Mind defining your terminology?-a-a "3 level locking", in particular? >>>>
    If you have to ask....

    1. No lock
    2. Write lock - Read only access, writer blocked until all readers
    out of critic al section)
    3. Read-write lock-a - all threads other than the one in section block) >>>>

    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11.

    And unix got pthreads in 1995. Windows a decade late as usual.

    Not useless then, just less useful.


    I never ever used what you call "3 level locking", not even by mistake.
    But then, I don't write complicated apps on "big" computers day in day
    out.

    Fine, most people will never use it, but for certain things its vital.


    Its simple, if you don't like windows, do use the damn pile.

    Argh! Damn typos! Don't use the damn pile! :^)
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 14:09:32 2026
    From Newsgroup: comp.lang.c++

    On 10/28/2026 2:06 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 22:04:33 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Mon, 26 Oct 2026 09:51:51 -0000 (UTC)
    boltar@caprica.universe wrote:
    Go ahead and remain clueless.



    system() can do most of the same things as spawn() family.

    Rubbish, you clearly didn't bother to spend 2 mins googling.

    The problem with system() is not that. Often not even an efficiency.
    The problem with system() identified most easily if we ask ourself "Why
    do we want xyz in standard library?"

    The problem with system is its fire and forget - all you can do with it is collect its exit code when its done. You can't communicate with it via
    pipes, you can't control it via signals (well, not easily), you can't set its process group, tty and on and on. Oh, and it also fires up the default shell to
    do the actual execution making it hideously inefficient. No serious unix dev uses system() unless thay have absolutely no choice or it really is a case of "go run this, I don't care what happens".



    Right. std::system, at least when I use it, makes the caller block until
    the process is done.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Oct 28 14:16:43 2026
    From Newsgroup: comp.lang.c++

    On 10/27/2026 6:43 PM, Lawrence DrCOOliveiro wrote:
    On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:

    ... without the context that applies elsewhere, your comment about
    resource allocation comes off as a non-sequitur.

    ThatrCOs just an excuse. Other comments of mine, from further back in
    this particular line of this thread:

    * rCLWhat if yourCOre building an object that needs to be returned to the
    caller?rCY
    * rCLThe principle applies to Fortran as it does to any language where
    you have to explicitly manage storage allocations.rCY
    * rCLIf you have to do cleanup at each level before exiting, then it works
    perfectly well.rCY

    Did you notice any of that?

    From elsewhere in the discussion:

    I find the C code I write tends to do a lot of dynamic resource
    allocations. These can sometimes fail with errors. So error
    recovery will invariably involve cleaning up those parts of the
    allocations which already succeeded. Gotos are no good for this;
    you need to exit levels of structure nesting one by one, disposing
    of allocations as you go.

    I put together an example here
    <https://gitlab.com/ldo/a_structured_discipline_of_programming>.
    This is an extension module that offers services to Python code,
    because that is just about the worst example I could think of, for
    those who think gotos can cut it.

    Did you pay attention to any of that?

    Its actually pretty simple. There are libs out there that allow the
    caller to create the memory it needs. io_uring is just one of them.

    DirectX12 is another. The user creates all the memory, aligns it, etc,
    and can update a single frame with a single memcpy.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Thu Oct 29 16:19:01 2026
    From Newsgroup: comp.lang.c++

    On Wed, 28 Oct 2026 14:04:02 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/28/2026 2:01 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 13:03:25 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
    Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking off
    something
    on the command line or creating a pipe (something else win32 is shit
    at) but
    thats about it.


    Shared state? Just use memory mapped files. You don't need pipes/
    sockets etc. You need to know how to properly sync things.

    Oh really? So you receive an incoming connection to a socket via an
    accept()
    call. In unix you can fork() at that point so the connecting client has a
    server process all to itself with all the state instantly copied from the
    parent process. HOw do you mimic that in windows? Start the server process >> from scratch and pass it a ton of state via the command line or using some >> roll-your-own shared memory nonsense? Give me a break. I guess in
    windows it
    spawns a thread leading to the issue of a single thread crashing
    bringing down
    the entire application - something multiprocess completely avoids.


    On Windows? Get used to

    https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsadup
    licatesocketa

    DuplicateHandle

    Right, lets duplicate everything manually - so much easier than one system call.
    And thats just file descriptors.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Thu Oct 29 16:20:39 2026
    From Newsgroup: comp.lang.c++

    On Wed, 28 Oct 2026 14:09:32 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/28/2026 2:06 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 22:04:33 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Mon, 26 Oct 2026 09:51:51 -0000 (UTC)
    boltar@caprica.universe wrote:
    Go ahead and remain clueless.



    system() can do most of the same things as spawn() family.

    Rubbish, you clearly didn't bother to spend 2 mins googling.

    The problem with system() is not that. Often not even an efficiency.
    The problem with system() identified most easily if we ask ourself "Why
    do we want xyz in standard library?"

    The problem with system is its fire and forget - all you can do with it is >> collect its exit code when its done. You can't communicate with it via
    pipes, you can't control it via signals (well, not easily), you can't set its

    process group, tty and on and on. Oh, and it also fires up the default shell >to
    do the actual execution making it hideously inefficient. No serious unix dev >> uses system() unless thay have absolutely no choice or it really is a case of

    "go run this, I don't care what happens".



    Right. std::system, at least when I use it, makes the caller block until
    the process is done.

    Thats true. Its been so long since I used it I'd forgotten about that. Makes
    it even less useful.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Thu Oct 29 12:49:55 2026
    From Newsgroup: comp.lang.c++

    On 10/29/2026 9:19 AM, boltar@caprica.universe wrote:
    On Wed, 28 Oct 2026 14:04:02 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/28/2026 2:01 AM, boltar@caprica.universe wrote:
    On Mon, 26 Oct 2026 13:03:25 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
    Creating a brand new process is fine if
    you don't need any complicated shared state such as when kicking
    off something
    on the command line or creating a pipe (something else win32 is
    shit at) but
    thats about it.


    Shared state? Just use memory mapped files. You don't need pipes/
    sockets etc. You need to know how to properly sync things.

    Oh really? So you receive an incoming connection to a socket via an
    accept()
    call. In unix you can fork() at that point so the connecting client
    has a
    server process all to itself with all the state instantly copied from
    the
    parent process. HOw do you mimic that in windows? Start the server
    process
    from scratch and pass it a ton of state via the command line or using
    some
    roll-your-own shared memory nonsense? Give me a break. I guess in
    windows it
    spawns a thread leading to the issue of a single thread crashing
    bringing down
    the entire application - something multiprocess completely avoids.


    On Windows? Get used to

    https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-
    winsock2-wsadup
    licatesocketa

    DuplicateHandle

    Right, lets duplicate everything manually - so much easier than one
    system call.
    And thats just file descriptors.


    Do we actually need everything, or just a subset?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Peter Flass@Peter@Iron-Spring.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Thu Oct 29 15:13:58 2026
    From Newsgroup: comp.lang.c++

    On 10/29/26 13:39, Michael S wrote:
    On Thu, 29 Oct 2026 16:22:29 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Thu, 29 Oct 2026 00:06:45 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Wed, 28 Oct 2026 08:58:55 -0000 (UTC)
    boltar@caprica.universe wrote:
    And unix got pthreads in 1995. Windows a decade late as usual.


    That's like if I'd say that Linux is 33 years (and counting) late
    because it has no QueueUserAPC(). Of course, I am smarter than saying
    such nonsense.

    More relevantly, Windows (Win32) has preemptive kernel-scheduled
    threads
    + assortment of synchronization primitives since very beginning
    (1993)
    - ahead of many Unixen and behind some of them. Certainly ahead of
    Posix standardisation of threads.

    Wow, pre-emptive multitasking in 1993. Incredible technology!


    Not just preemptive multitasking between processes, but
    kernel-scheduled threads within each process as well.
    Not a novel idea, but the one that eventually won over all others.
    In 1993 it was already obvious that it is going to win, but in
    1988-1989, when development started, it was less trivial.

    Just an old idea from OS/360 MVT circa 1965-66. OS calls them tasks.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Fri Oct 30 11:21:03 2026
    From Newsgroup: comp.lang.c++

    On Thu, 29 Oct 2026 12:49:55 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/29/2026 9:19 AM, boltar@caprica.universe wrote:
    Right, lets duplicate everything manually - so much easier than one
    system call.
    And thats just file descriptors.


    Do we actually need everything, or just a subset?

    That will depend entirely on the application. There could be a boatload of startup config in memory plus all the enviroment variables.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Fri Oct 30 11:05:53 2026
    From Newsgroup: comp.lang.c++

    On 10/30/2026 4:25 AM, boltar@caprica.universe wrote:
    On Thu, 29 Oct 2026 22:39:22 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Thu, 29 Oct 2026 16:22:29 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Thu, 29 Oct 2026 00:06:45 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Wed, 28 Oct 2026 08:58:55 -0000 (UTC)
    boltar@caprica.universe wrote:
    And unix got pthreads in 1995. Windows a decade late as usual.


    That's like if I'd say that Linux is 33 years (and counting) late
    because it has no QueueUserAPC(). Of course, I am smarter than saying
    such nonsense.

    More relevantly, Windows (Win32) has preemptive kernel-scheduled
    threads
    + assortment of synchronization primitives since very beginning
    (1993)
    - ahead of many Unixen and behind some of them. Certainly ahead of
    Posix standardisation of threads.

    Wow, pre-emptive multitasking in 1993. Incredible technology!


    Not just preemptive multitasking between processes, but
    kernel-scheduled threads within each process as well.
    Not a novel idea, but the one that eventually won over all others.
    In 1993 it was already obvious that it is going to win, but in
    1988-1989, when development started, it was less trivial.

    Implementing threads is trivial compared to implementing multi processes with shared memory. Adding them to a pre-existing kernel might be tricky but when you're building one from scratch as per NT then its hardly a big deal.


    Multi process with shared memory can be tricky indeed. Step one, you
    need to ponder on making it "robust". Threads do not need to be robust.
    Well, you should not have a thread up and die anyway. Now, for multi
    process, that should be handled. There are many different ways.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 31 09:45:04 2026
    From Newsgroup: comp.lang.c++

    On Fri, 30 Oct 2026 22:35:05 -0000 (UTC)
    Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
    The trend nowadays is to revive the old coroutine concept, in a new
    guise called rCLstacklessrCY coroutines. These give you support for async >operations, but with transfers of control being made explicit at
    rCLawaitrCY points, rather than unpredictably as with full preemptive >threading. This greatly reduces the opportunity for race conditions.

    Coroutines are just a complicated way to re-implement a function with a load
    of statics.

    eg:

    void myfunc()
    {
    static int i = 0;
    for(;;++i)
    {
    [do something based on value of i]
    [return when some condition met]
    }
    }

    Also the C++ implementation is so bad its unusable.

    Credit to Microsoft for pioneering this, but nowadays you see the idea >popping up in JavaScript and Python and who knows where else.

    Python nailed it - you just call "yield", job done.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 31 09:47:42 2026
    From Newsgroup: comp.lang.c++

    On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
    Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
    HererCOs a fun little thing: if you set a socket to nonblocking and then
    do the connect(2) call, it will seemingly fail with an EINPROGRESS
    error. But in fact, the connection attempt gets initiated, and you can >monitor its subsequent progress from your event loop.

    Far too many devs don't know about or don't understand multiplexing using select() or poll(). Admittedly these are borked on Windows as you can't
    use sockets with them which is their main raison d'etre, but on unix they're a very powerful tool. For simple servers with a low workload they can allow single threaded development simplifying the code immensely.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 31 13:11:29 2026
    From Newsgroup: comp.lang.c++

    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 20:37:14 +0100
    Jeroen Belleman <jeroen@nospam.please> gabbled:
    On 10/30/26 17:07, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261030105900.000020ce@yahoo.com>,
    Michael S-a <already5chosen@yahoo.com> wrote:
    Only if you intended to close the TTY the programs were started
    on.-a Otherwise, I don't see why it would be necessary:

    What happens when caller is GUI-style application?

    That depends on a number of factors, but basically, "it does the
    same thing".-a Why would it be any different?

    Windows treats GUI apps entirely differently to console ones so a
    Windows
    dev might not appreciate that on unix there is no demarcation - a GUI
    app
    simply has a network connection to the X server and it can either sit in >>> an event loop waiting for events - as per a windows main thread - or
    go do
    other things and periodically check the X event list.


    That's where threads are useful: The GUI is one thread, and the "other
    things" are in one or more other threads. There are altogether too many
    programs that hang the GUI while "other things" are going on. That
    should never happen!

    If its multithreaded but that still happens someone probably has created
    too
    many critical sections with too many locks.


    What do you mean? Is the GUI deadlocking?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sat Oct 31 13:14:47 2026
    From Newsgroup: comp.lang.c++

    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 20:37:14 +0100
    Jeroen Belleman <jeroen@nospam.please> gabbled:
    On 10/30/26 17:07, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261030105900.000020ce@yahoo.com>,
    Michael S-a <already5chosen@yahoo.com> wrote:
    Only if you intended to close the TTY the programs were started
    on.-a Otherwise, I don't see why it would be necessary:

    What happens when caller is GUI-style application?

    That depends on a number of factors, but basically, "it does the
    same thing".-a Why would it be any different?

    Windows treats GUI apps entirely differently to console ones so a
    Windows
    dev might not appreciate that on unix there is no demarcation - a GUI
    app
    simply has a network connection to the X server and it can either sit in >>> an event loop waiting for events - as per a windows main thread - or
    go do
    other things and periodically check the X event list.


    That's where threads are useful: The GUI is one thread, and the "other
    things" are in one or more other threads. There are altogether too many
    programs that hang the GUI while "other things" are going on. That
    should never happen!

    If its multithreaded but that still happens someone probably has created
    too
    many critical sections with too many locks.


    Makes no sense at all. Have you taken a look at my multex? It can create
    a shit lod of mutexes, and never deadlock. It keeps a strict locking
    order. Sorts and dedups the mutexes. Also, notice that an object does
    not need its own mutex:





    So, I have the most recent version and coded up my old multex algo. It
    100% dead lock free and allows a thread to locks multiple objects in any
    order and lock them. All of the lock ordering is taken care of in the
    finalize function. Basically a thread seeds its per thread lock indices
    with addresses to objects it wants to lock. Calls finalize, then locks
    them. Does its thing and then unlocks them. Fwiw, here is my Relacy test output:

    struct ct_multex_relacy_test_v000
    65% (65536/100000)
    iterations: 100000
    total time: 9390
    throughput: 10649


    D:\ct_dev\ct_msvc\projects\ct_relacy_test\x64\Debug\ct_relacy_test.exe (process 13356) exited with code 0 (0x0).
    Press any key to close this window . . .


    Any my code:

    #include <relacy/relacy.hpp>
    #include <cstdio>
    #include <cstddef>
    #include <cstdlib>
    #include <string>
    #include <vector>

    #if ! defined (NDEBUG)
    # define CT_DBG_PRINTF(e) std::printf e
    #else
    # define CT_DBG_PRINTF(e) ((void)0)
    #endif


    #define CT_THREADS (5)
    #define CT_MUTEX_TABLE_N (64)


    struct ct_mutex_table
    {
    rl::mutex m_mutexs[CT_MUTEX_TABLE_N];

    std::size_t
    hash_ptr(
    void* p
    ) const {
    return rl::hash_ptr(p, CT_MUTEX_TABLE_N);
    }
    };


    struct ct_thread_mutex_hash
    {
    std::vector<std::size_t> m_hashed_idxs;

    // must be before any locks!
    void finalize()
    {
    std::sort(
    m_hashed_idxs.begin(),
    m_hashed_idxs.end());

    m_hashed_idxs.erase(
    std::unique(
    m_hashed_idxs.begin(),
    m_hashed_idxs.end()),
    m_hashed_idxs.end());
    }


    // BEFORE WE CALL, WE NEED TO sort and dedup before this.
    void
    lock(
    ct_mutex_table& mutex_table
    ) {
    for (auto& mtx_idx : m_hashed_idxs)
    {
    rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
    mtx.lock($);
    }
    }

    // does not really even need to be reversed...
    void
    unlock(
    ct_mutex_table& mutex_table
    ) {
    for (auto& mtx_idx : m_hashed_idxs)
    {
    rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
    mtx.unlock($);
    }
    }
    };


    struct ct_state
    {
    ct_mutex_table m_mutex_table;
    VAR_T(int) m_var_0 = 0;
    VAR_T(int) m_var_1 = 1;
    VAR_T(int) m_var_2 = 2;


    void worker_thread_a()
    {
    ct_thread_mutex_hash self_hash;

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_0));

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_1));

    self_hash.finalize();

    self_hash.lock(m_mutex_table);

    VAR(m_var_0) = 42;
    VAR(m_var_1) = 128;

    self_hash.unlock(m_mutex_table);
    }

    void worker_thread_b()
    {
    ct_thread_mutex_hash self_hash;

    // Seed!
    {
    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_1));

    self_hash.m_hashed_idxs.push_back(
    m_mutex_table.hash_ptr(&m_var_0));
    }


    // Okay... Finalize it...
    {
    self_hash.finalize();
    }


    // Finally, we can lock the bastard!
    {
    self_hash.lock(m_mutex_table);

    {
    VAR(m_var_0) = 99;
    VAR(m_var_1) = 77;
    }

    self_hash.unlock(m_mutex_table);
    }
    }
    };


    struct ct_multex_relacy_test_v000
    : rl::test_suite<ct_multex_relacy_test_v000, CT_THREADS>
    {
    ct_state m_state = { };

    void before()
    {
    // not sure to init m_state here. Is it already init?
    }

    void
    thread(
    unsigned tidx
    ) {
    if (tidx == 0)
    m_state.worker_thread_a();
    else
    m_state.worker_thread_b();
    }
    };


    int main(int argc, char** argv)
    {
    {
    rl::test_params p;

    p.iteration_count = argc > 1 ? (unsigned)atoi(argv[1]) : 100000;
    p.execution_depth_limit = 100000;

    if (argc > 2) {
    std::string m = argv[2];
    if (m == "full") p.search_type = rl::sched_full;
    else if (m == "bound") { p.search_type = rl::sched_bound; p.context_bound = argc > 3 ? atoi(argv[3]) : 2; }
    }

    rl::simulate<ct_multex_relacy_test_v000>(p);
    }

    return 0;
    }



    /*
    #include <relacy/relacy.hpp>
    #include <iostream>


    int
    main()
    {
    std::cout << "ct_relacy_test\n";
    std::cout << "____________________________________________" <<
    std::endl;

    {

    }

    std::cout << "____________________________________________" <<
    std::endl;
    std::cout << "ct_relacy_test fin! :^)\n";

    return 0;
    }

    */



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Nov 1 08:33:22 2026
    From Newsgroup: comp.lang.c++

    On Sat, 31 Oct 2026 13:11:29 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 20:37:14 +0100
    Jeroen Belleman <jeroen@nospam.please> gabbled:
    On 10/30/26 17:07, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261030105900.000020ce@yahoo.com>,
    Michael S-a <already5chosen@yahoo.com> wrote:
    Only if you intended to close the TTY the programs were started
    on.-a Otherwise, I don't see why it would be necessary:

    What happens when caller is GUI-style application?

    That depends on a number of factors, but basically, "it does the
    same thing".-a Why would it be any different?

    Windows treats GUI apps entirely differently to console ones so a
    Windows
    dev might not appreciate that on unix there is no demarcation - a GUI >>>> app
    simply has a network connection to the X server and it can either sit in >>>> an event loop waiting for events - as per a windows main thread - or
    go do
    other things and periodically check the X event list.


    That's where threads are useful: The GUI is one thread, and the "other
    things" are in one or more other threads. There are altogether too many
    programs that hang the GUI while "other things" are going on. That
    should never happen!

    If its multithreaded but that still happens someone probably has created
    too
    many critical sections with too many locks.


    What do you mean? Is the GUI deadlocking?

    What do I mean? If you don't understand the concepts of multithreading then maybe stay out of the discussion.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Nov 1 08:34:55 2026
    From Newsgroup: comp.lang.c++

    On Sat, 31 Oct 2026 13:14:47 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    If its multithreaded but that still happens someone probably has created
    too
    many critical sections with too many locks.


    Makes no sense at all. Have you taken a look at my multex? It can create

    WTF has your multex got to do with anything? No one was talking about your
    code so don't use this discussion as some excuse to show off some code you wrote than no one cares about.

    a shit lod of mutexes, and never deadlock. It keeps a strict locking
    order. Sorts and dedups the mutexes. Also, notice that an object does
    not need its own mutex:

    Thats nice.

    tl;dr

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Johann 'Myrkraverk' Oskarsson@johann@myrkraverk.invalid to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 06:17:45 2026
    From Newsgroup: comp.lang.c++

    On 10/27/2026 3:45 AM, Michael S wrote:
    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11. https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader- writer--srw--locks
    Of course WinXP remained popular for few more years, approximately up
    until 2nd half of 2010, but that too predates publication of C++11 in 2011-09.

    Wasn't that work done in preparation for the C++11 standard? I did not
    keep track of the standard's discussion, but presumably Microsoft had
    people both on the C++ standard's committee, and the Vista programming
    team.


    Best wishes, and happy standards!
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
    Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Nov 1 23:38:32 2026
    From Newsgroup: comp.lang.c++

    Anyway, to get the discussion back on track:

    I put together an example here <https://gitlab.com/ldo/a_structured_discipline_of_programming>. This
    is an extension module that offers services to Python code, because
    that is just about the worst example I could think of, for those who
    think gotos can cut it.

    Problems I am trying to address:

    * Leaking memory: allocating something and forgetting to dispose of
    it
    * Double-free: the opposite problem, trying to free a memory block
    that has already been freed

    The basic structured-programming pattern I follow is:

    1: Initialize a pointer variable to `NULL`
    2: Allocate memory for the pointer (this might fail)
    3: Correctly free the pointer memory, regardless of allocation
    success/failure

    This project uses the implementation of a Python extension module as a
    specific example, since Python itself is a highly dynamic language,
    and so code that is written in a lower-level-language like C for
    interfacing to Python typically has to deal a lot with allocation and management of Python objects and other dynamic memory.

    In more concrete terms, the code pattern looks like this:

    PyObject * obj = NULL; /* step 1 */
    do /*once*/
    {
    ... possible other stuff ...
    allocate obj; /* step 2 */
    if (PyErr_Occurred())
    break;
    ... possible other stuff using obj ...
    }
    while (false);
    Py_XDECREF(obj); /* step 3 */

    Assuming there are no `goto`s in the rCL...rCY parts (or `return`
    statements, or shenanigans like `setjmp`(3)/`longjmp`(3)), it should
    be clear that, regardless of what happens in those parts (provided
    they donrCOt free or reallocate `obj`), any memory allocated to `obj`
    will be correctly freed.

    Key to this pattern is the fact that `Py_XDECREF` is a noop (and
    raises no error) if it is passed a `NULL` pointer. This is also the
    semantics of the `free`(3) routine in the C standard library, and I
    recommend that any memory-disposal routine you create implement the
    same behaviour. It saves checking for unallocated storage in the
    cleanup code: just unconditionally dispose of everything temporary
    that might have been allocated.

    The above basic structure scales easily. For example, coping with
    multiple objects needing allocating:

    PyObject * obj1 = NULL;
    PyObject * obj2 = NULL;
    do /*once*/
    {
    ... possible other stuff ...
    allocate obj1;
    if (PyErr_Occurred())
    break;
    ... possible other stuff using obj1 ...
    allocate obj2;
    if (PyErr_Occurred())
    break;
    ... possible other stuff using obj1 and obj2 ...
    }
    while (false);
    Py_XDECREF(obj1);
    Py_XDECREF(obj2);

    Nested blocks:

    PyObject * obj1 = NULL;
    do /*once*/
    {
    ... possible other stuff ...
    allocate obj1;
    if (PyErr_Occurred())
    break;
    ... possible other stuff using obj1 ...
    {
    PyObject * obj2 = NULL;
    do /*once*/
    {
    ... even more possible stuff using obj1 ...
    allocate obj2;
    if (PyErr_Occurred())
    break;
    ... possible other stuff using obj1 and obj2 ...
    }
    while (false);
    Py_XDECREF(obj2);
    }
    if (PyErr_Occurred())
    break;
    ... yet more possible stuff using obj1 ...
    }
    while (false);
    Py_XDECREF(obj1);

    Allocation within loops:

    for (ssize_t i = 0;;)
    {
    if (i == nr_items)
    break;
    PyObject * const item = PyTuple_GetItem(items, i);
    if (item == NULL)
    break;
    {
    PyObject * key = NULL;
    PyObject * value = NULL;
    do /*once*/
    {
    ... construct key ...
    if (PyErr_Occurred())
    break;
    ... construct value ...
    if (PyErr_Occurred())
    break;
    if (PyDict_SetItem(tempresult, key, value) < 0)
    break;
    }
    while (false);
    Py_XDECREF(key);
    Py_XDECREF(value);
    }
    if (PyErr_Occurred())
    break;
    ++i;
    } /*for*/
    if (PyErr_Occurred())
    break;

    Etc, etc.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Nov 1 18:03:06 2026
    From Newsgroup: comp.lang.c++

    On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 13:11:29 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 20:37:14 +0100
    Jeroen Belleman <jeroen@nospam.please> gabbled:
    On 10/30/26 17:07, boltar@caprica.universe wrote:
    On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
    cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
    In article <20261030105900.000020ce@yahoo.com>,
    Michael S-a <already5chosen@yahoo.com> wrote:
    Only if you intended to close the TTY the programs were started >>>>>>>> on.-a Otherwise, I don't see why it would be necessary:

    What happens when caller is GUI-style application?

    That depends on a number of factors, but basically, "it does the
    same thing".-a Why would it be any different?

    Windows treats GUI apps entirely differently to console ones so a
    Windows
    dev might not appreciate that on unix there is no demarcation - a
    GUI app
    simply has a network connection to the X server and it can either
    sit in
    an event loop waiting for events - as per a windows main thread -
    or go do
    other things and periodically check the X event list.


    That's where threads are useful: The GUI is one thread, and the
    "other things" are in one or more other threads. There are
    altogether too many
    programs that hang the GUI while "other things" are going on. That
    should never happen!

    If its multithreaded but that still happens someone probably has
    created too
    many critical sections with too many locks.


    What do you mean? Is the GUI deadlocking?

    What do I mean? If you don't understand the concepts of multithreading then maybe stay out of the discussion.


    Ummm. I think you are the one that does not know what the heck they are talking about.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Sun Nov 1 18:04:13 2026
    From Newsgroup: comp.lang.c++

    On 11/1/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 13:14:47 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    If its multithreaded but that still happens someone probably has
    created too
    many critical sections with too many locks.


    Makes no sense at all. Have you taken a look at my multex? It can create

    WTF has your multex got to do with anything? No one was talking about your code so don't use this discussion as some excuse to show off some code you wrote than no one cares about.

    It uses a table of a lot of mutexes. Never deadlocks. So, you need to
    study up? You said "too many critical sections with too many locks."

    Well, if you don't know how to use them, don't use them. Learn first?


    a shit lod of mutexes, and never deadlock. It keeps a strict locking
    order. Sorts and dedups the mutexes. Also, notice that an object does
    not need its own mutex:

    Thats nice.

    tl;dr


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 15:44:29 2026
    From Newsgroup: comp.lang.c++

    On Sun, 1 Nov 2026 18:03:06 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
    What do you mean? Is the GUI deadlocking?

    What do I mean? If you don't understand the concepts of multithreading then >> maybe stay out of the discussion.


    Ummm. I think you are the one that does not know what the heck they are >talking about.

    Yeah, ok. I've only been using pthreads for the last 25 years but sure, what
    do I know.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 15:45:29 2026
    From Newsgroup: comp.lang.c++

    On Sun, 1 Nov 2026 18:04:13 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 13:14:47 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    If its multithreaded but that still happens someone probably has
    created too
    many critical sections with too many locks.


    Makes no sense at all. Have you taken a look at my multex? It can create >>
    WTF has your multex got to do with anything? No one was talking about your >> code so don't use this discussion as some excuse to show off some code you >> wrote than no one cares about.

    It uses a table of a lot of mutexes. Never deadlocks. So, you need to
    study up? You said "too many critical sections with too many locks."

    Well, if you don't know how to use them, don't use them. Learn first?

    I have no desire to spend hours trawling through someones pet project so they can make a point about what a L337 coder they are. HTH.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 14:33:41 2026
    From Newsgroup: comp.lang.c++

    On 11/2/2026 7:45 AM, boltar@caprica.universe wrote:
    On Sun, 1 Nov 2026 18:04:13 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:34 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 13:14:47 -0700
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
    If its multithreaded but that still happens someone probably has
    created too
    many critical sections with too many locks.


    Makes no sense at all. Have you taken a look at my multex? It can
    create

    WTF has your multex got to do with anything? No one was talking about
    your
    code so don't use this discussion as some excuse to show off some
    code you
    wrote than no one cares about.

    It uses a table of a lot of mutexes. Never deadlocks. So, you need to
    study up? You said "too many critical sections with too many locks."

    Well, if you don't know how to use them, don't use them. Learn first?

    I have no desire to spend hours trawling through someones pet project so they
    can make a point about what a L337 coder they are. HTH.


    The code is not all that complicated?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 14:34:40 2026
    From Newsgroup: comp.lang.c++

    On 11/2/2026 7:44 AM, boltar@caprica.universe wrote:
    On Sun, 1 Nov 2026 18:03:06 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
    What do you mean? Is the GUI deadlocking?

    What do I mean? If you don't understand the concepts of
    multithreading then
    maybe stay out of the discussion.


    Ummm. I think you are the one that does not know what the heck they
    are talking about.

    Yeah, ok. I've only been using pthreads for the last 25 years but sure,
    what
    do I know.


    So you know what you wrote is odd wrt using too many mutexes? You
    snipped it out.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 14:54:48 2026
    From Newsgroup: comp.lang.c++

    On 11/1/2026 2:17 PM, Johann 'Myrkraverk' Oskarsson wrote:
    On 10/27/2026 3:45 AM, Michael S wrote:
    Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
    time as conditional variables. 5 years before C++11.
    https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-
    writer--srw--locks
    Of course WinXP remained popular for few more years, approximately up
    until 2nd half of 2010, but that too predates publication of C++11 in
    2011-09.

    Wasn't that work done in preparation for the C++11 standard?-a I did not
    keep track of the standard's discussion, but presumably Microsoft had
    people both on the C++ standard's committee, and the Vista programming
    team.

    I think so.




    Best wishes, and happy standards!

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 14:59:26 2026
    From Newsgroup: comp.lang.c++

    On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 19:56:10 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
    Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid> gabbled: >>>> Here=E2=80=99s a fun little thing: if you set a socket to nonblocking and >>>> then do the connect(2) call, it will seemingly fail with an
    EINPROGRESS error. But in fact, the connection attempt gets
    initiated, and you can monitor its subsequent progress from your
    event loop. =20
    =20
    Far too many devs don't know about or don't understand multiplexing
    using select() or poll(). Admittedly these are borked on Windows as
    you can't use sockets with them=20

    On what planet?

    On this one where you see code that is only multithreaded in order to serve individual sockets, not because it needs to be.


    Either you are trolling or don't have a clue?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 15:00:03 2026
    From Newsgroup: comp.lang.c++

    On 11/2/2026 7:43 AM, boltar@caprica.universe wrote:
    On Sun, 1 Nov 2026 21:59:41 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
    boltar@caprica.universe wrote:
    On this one where you see code that is only multithreaded in order to
    serve individual sockets, not because it needs to be.


    That's because many people unable to implement state machines. Or able,
    but don't like them.
    It has nothing to do with availability and functionality of select/poll
    on Windows.

    Last time I had the misfortune to use win32 it couldn't multiplex on sockets.


    Ever use Nt say 4.0? IOCP?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 15:02:44 2026
    From Newsgroup: comp.lang.c++

    On 11/2/2026 1:46 PM, Michael S wrote:
    On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 1 Nov 2026 21:59:41 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
    boltar@caprica.universe wrote:
    On this one where you see code that is only multithreaded in order
    to serve individual sockets, not because it needs to be.


    That's because many people unable to implement state machines. Or
    able, but don't like them.
    It has nothing to do with availability and functionality of
    select/poll on Windows.

    Last time I had the misfortune to use win32 it couldn't multiplex on
    sockets.


    That's nonsense. That part of Winsock2 API did not change since 1993.
    That is, in early 2000s they added poll() (WAASAPoll), but select() is
    the same BSD select() from the very beginning, just a little easier to
    use than original, because nfds is DNC.
    Now, if you woulds say that on Winsock2 select() can't multiplex
    waiting for socket I/O with waiting for other sorts of I/O (files and
    pipes) then your statement would make more sense*.
    But it does not sound like you really want to make sense. You strongly
    prefer mindless bashing.

    ----
    * - Although,
    1) of course, there (in Win32) exist not too complicated alternative
    methods to achieve such multiplexing as well. Just not via select().
    2) today, with nearly all file I/O deeply cached, multiplexing waiting
    for file I/O with waiting for sockets is a bad idea. OTOH, Multiplexing sockets with pipes could still make sense, infrequently.



    Well, before IOCP we would need to use WaitForMultipleObjects, iirc. But
    there was a trick we had to use. We had to alter the indices! Shift
    them, or even randomize them.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Mon Nov 2 15:03:44 2026
    From Newsgroup: comp.lang.c++

    On 11/2/2026 1:46 PM, Michael S wrote:
    On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 1 Nov 2026 21:59:41 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
    boltar@caprica.universe wrote:
    On this one where you see code that is only multithreaded in order
    to serve individual sockets, not because it needs to be.


    That's because many people unable to implement state machines. Or
    able, but don't like them.
    It has nothing to do with availability and functionality of
    select/poll on Windows.

    Last time I had the misfortune to use win32 it couldn't multiplex on
    sockets.


    That's nonsense. That part of Winsock2 API did not change since 1993.
    That is, in early 2000s they added poll() (WAASAPoll), but select() is
    the same BSD select() from the very beginning, just a little easier to
    use than original, because nfds is DNC.
    Now, if you woulds say that on Winsock2 select() can't multiplex
    waiting for socket I/O with waiting for other sorts of I/O (files and
    pipes) then your statement would make more sense*.
    But it does not sound like you really want to make sense. You strongly
    prefer mindless bashing.

    ----
    * - Although,
    1) of course, there (in Win32) exist not too complicated alternative
    methods to achieve such multiplexing as well. Just not via select().
    2) today, with nearly all file I/O deeply cached, multiplexing waiting
    for file I/O with waiting for sockets is a bad idea. OTOH, Multiplexing sockets with pipes could still make sense, infrequently.



    Have you ever used IOCP on windows?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Tue Nov 3 13:10:09 2026
    From Newsgroup: comp.lang.c++

    On 11/3/2026 11:51 AM, Michael S wrote:
    On Mon, 2 Nov 2026 15:03:44 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:

    On 11/2/2026 1:46 PM, Michael S wrote:
    On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 1 Nov 2026 21:59:41 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
    boltar@caprica.universe wrote:
    On this one where you see code that is only multithreaded in
    order to serve individual sockets, not because it needs to be.


    That's because many people unable to implement state machines. Or
    able, but don't like them.
    It has nothing to do with availability and functionality of
    select/poll on Windows.

    Last time I had the misfortune to use win32 it couldn't multiplex
    on sockets.


    That's nonsense. That part of Winsock2 API did not change since
    1993. That is, in early 2000s they added poll() (WAASAPoll), but
    select() is the same BSD select() from the very beginning, just a
    little easier to use than original, because nfds is DNC.
    Now, if you woulds say that on Winsock2 select() can't multiplex
    waiting for socket I/O with waiting for other sorts of I/O (files
    and pipes) then your statement would make more sense*.
    But it does not sound like you really want to make sense. You
    strongly prefer mindless bashing.

    ----
    * - Although,
    1) of course, there (in Win32) exist not too complicated alternative
    methods to achieve such multiplexing as well. Just not via select().
    2) today, with nearly all file I/O deeply cached, multiplexing
    waiting for file I/O with waiting for sockets is a bad idea. OTOH,
    Multiplexing sockets with pipes could still make sense,
    infrequently.



    Have you ever used IOCP on windows?

    No, I didn't.
    IMHO, IO compleiion ports "solve" problems that do not exist today
    and mostly did not exist since 15-20 years ago.


    Are you suggesting that IOCP is useless? What about AIO or io_uring? AIO
    is basically IOCP anyway. io_uring is special, but still uses a
    "completion" setup.


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 08:54:51 2026
    From Newsgroup: comp.lang.c++

    On Mon, 2 Nov 2026 14:59:26 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 19:56:10 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
    Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid> gabbled: >>>>> Here=E2=80=99s a fun little thing: if you set a socket to nonblocking and >>>>> then do the connect(2) call, it will seemingly fail with an
    EINPROGRESS error. But in fact, the connection attempt gets
    initiated, and you can monitor its subsequent progress from your
    event loop. =20
    =20
    Far too many devs don't know about or don't understand multiplexing
    using select() or poll(). Admittedly these are borked on Windows as
    you can't use sockets with them=20

    On what planet?

    On this one where you see code that is only multithreaded in order to serve >> individual sockets, not because it needs to be.


    Either you are trolling or don't have a clue?

    Seems to be your standard response to anyone you disagree with. Go back under your bridge.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 02:22:52 2026
    From Newsgroup: comp.lang.c++

    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    On Mon, 2 Nov 2026 14:59:26 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 19:56:10 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
    Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid>
    gabbled:
    Here=E2=80=99s a fun little thing: if you set a socket to
    nonblocking and
    then do the connect(2) call, it will seemingly fail with an
    EINPROGRESS error. But in fact, the connection attempt gets
    initiated, and you can monitor its subsequent progress from your
    event loop. =20
    =20
    Far too many devs don't know about or don't understand multiplexing
    using select() or poll(). Admittedly these are borked on Windows as
    you can't use sockets with them=20

    On what planet?

    On this one where you see code that is only multithreaded in order to
    serve
    individual sockets, not because it needs to be.


    Either you are trolling or don't have a clue?

    Seems to be your standard response to anyone you disagree with. Go back under
    your bridge.


    Really? Why do you have a hatred for say, IOCP? If so, you must also
    HATE AIO, or io_uring?
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 02:24:07 2026
    From Newsgroup: comp.lang.c++

    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    On Mon, 2 Nov 2026 14:59:26 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
    On Sat, 31 Oct 2026 19:56:10 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
    Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid>
    gabbled:
    Here=E2=80=99s a fun little thing: if you set a socket to
    nonblocking and
    then do the connect(2) call, it will seemingly fail with an
    EINPROGRESS error. But in fact, the connection attempt gets
    initiated, and you can monitor its subsequent progress from your
    event loop. =20
    =20
    Far too many devs don't know about or don't understand multiplexing
    using select() or poll(). Admittedly these are borked on Windows as
    you can't use sockets with them=20

    On what planet?

    On this one where you see code that is only multithreaded in order to
    serve
    individual sockets, not because it needs to be.


    Either you are trolling or don't have a clue?

    Seems to be your standard response to anyone you disagree with. Go back under
    your bridge.


    Before you listen to this, be sure to not in a mood to get really pissed
    off:

    https://youtu.be/mrKKBBUQnYg

    ;^) too late. Your fate of windows is misguided. It has some fun things.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 02:34:52 2026
    From Newsgroup: comp.lang.c++

    On 10/27/2026 8:03 AM, Scott Lurndal wrote:
    cross@spitfire.i.gajendra.net (Dan Cross) writes:
    In article <20261027102255.00006052@yahoo.com>,
    Michael S <already5chosen@yahoo.com> wrote:
    On Tue, 27 Oct 2026 09:06:26 +0100
    David Brown <david.brown@hesbynett.no> wrote:
    [snip]
    And there are languages like Erlang that divide everything into
    micro-processes, and use the same mechanisms for controlling and
    passing data around regardless of whether this little processes are
    in the same thread, or different threads, different OS processes, or
    different computers. That works because there are very narrow and
    tightly controlled mechanisms for sharing data.

    Note that these are both languages that run on a VM, not compiled
    languages.

    What you wrote about Erlang resembles MPI, which of course is readily
    available for many compiled or jitted languages, including Fortran, C
    and C++.
    I tried to utilize MPI 20 years ago, but the thinking behind it is to
    different from mine, so I ran away in horror.

    Erlang uses the "actor" model to represent concurrency; state is
    held by each actor, and actors communicate via message passing,
    potentially changing state in response to messages. This is a
    model for _concurrency_, in which multiple independent threads
    of execution are coordinated to some in a single system.

    Chorus (the microkernel) worked in a similar fashion. The
    microkernel coordinated between actors using message passing.

    The actors implemented the higher level operating system
    functionality. The Amadeus project, for example, implemented
    a version of unix on top of the microkernel using message
    passing between actors (The Object manager handled files and
    filesystems, the Process actor handled the POSIX process
    and thread (SVR4.2ES/MP threads) interfaces including fork,
    and light-weight processes that implemented threads, and
    the Streams actor provide system V streams support and
    networking.

    Unisys released the OS as part of their massively parallel
    OPUS computer system.

    There are many ways to handle proper sync in multiprocess systems. Indeed.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 02:38:55 2026
    From Newsgroup: comp.lang.c++

    On 10/22/2026 12:20 AM, David Brown wrote:
    [...]
    For the particular case of why C++ supports threads but not processes,
    the answer should be obvious.

    Indeed!

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 02:48:17 2026
    From Newsgroup: comp.lang.c++

    On 10/27/2026 11:36 AM, Scott Lurndal wrote:
    Peter Flass <Peter@Iron-Spring.com> writes:
    On 10/27/26 08:00, James Kuyper wrote:
    On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
    On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
    [restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote: >>>>>> On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:

    A caller provided buffer is normal with a lot of API's out there. >>>>>>
    No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of
    solving the resource-allocation problem once and for all in the
    library API, you are pushing the burden onto all the client code, each >>>>>> one of which has to solve it for itself.

    ThatrCOs a dumb way to design things.

    HUH? How do you call say, fread without a user provided buffer?

    Relevance being?

    fread() uses a caller-provided buffer, which, according to your previous >>> comment, "push[es] the burden onto all the client code, each one of
    which has to solve it for itself", so according to you, "That's a dumb
    way to design things"..If that isn't your actual opinion of fread(),
    your comments need to be at least a little more nuanced to avoid
    applying to fread().

    The difference is that the size of the buffer for fread() is the maximum
    you want/expect to read. The size of an object is the size it is, not
    necessarily what you expect. If you don't provide enough space you will
    truncate.

    Which isn't a significant issue with fread, since the underlying stdio
    buffer (or kernel file cache or terminal driver buffer) will hold the
    unread information for the next call to fread.

    fread(3) is basically obsolete for most high-performance applications
    which map the file directly into the process address space (mmap).

    Ditto.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 16:22:23 2026
    From Newsgroup: comp.lang.c++

    On Wed, 4 Nov 2026 02:22:52 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    Seems to be your standard response to anyone you disagree with. Go back
    under
    your bridge.


    Really? Why do you have a hatred for say, IOCP? If so, you must also
    HATE AIO, or io_uring?

    I never mentioned IOCP but looking at it, yeah, looks like your standard Windows approach of chucking threads at everything.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 10:56:20 2026
    From Newsgroup: comp.lang.c++

    On 11/4/2026 8:22 AM, boltar@caprica.universe wrote:
    On Wed, 4 Nov 2026 02:22:52 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    Seems to be your standard response to anyone you disagree with. Go
    back under
    your bridge.


    Really? Why do you have a hatred for say, IOCP? If so, you must also
    HATE AIO, or io_uring?

    I never mentioned IOCP but looking at it, yeah, looks like your standard Windows approach of chucking threads at everything.


    Huh? You mean a thread pool, sometimes we can oversubscribe and use
    hardware threads * 2

    I don't think you should mock IOCP. Then you would be mocking AIO, or io_uring.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From boltar@boltar@caprica.universe to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 19:53:33 2026
    From Newsgroup: comp.lang.c++

    On Wed, 4 Nov 2026 10:56:20 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 8:22 AM, boltar@caprica.universe wrote:
    On Wed, 4 Nov 2026 02:22:52 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    Seems to be your standard response to anyone you disagree with. Go
    back under
    your bridge.


    Really? Why do you have a hatred for say, IOCP? If so, you must also
    HATE AIO, or io_uring?

    I never mentioned IOCP but looking at it, yeah, looks like your standard
    Windows approach of chucking threads at everything.


    Huh? You mean a thread pool, sometimes we can oversubscribe and use
    hardware threads * 2

    I don't care if its a thread ocean, its still threads being used where they're possibly not needed. Obviously depends on load. But if I'm writing a client such as ssh where the only I/O is via stdin and the socket I'm going to multiplex them in select() or poll(), not have 2 seperate threads.

    I don't think you should mock IOCP. Then you would be mocking AIO, or >io_uring.

    I don't give a toss about IOCP, its a windows thing.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Gary Scott@garylscott@sbcglobal.net to comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers on Wed Nov 4 14:17:02 2026
    From Newsgroup: comp.lang.c++

    On 11/4/2026 1:53 PM, boltar@caprica.universe wrote:
    On Wed, 4 Nov 2026 10:56:20 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 8:22 AM, boltar@caprica.universe wrote:
    On Wed, 4 Nov 2026 02:22:52 -0800
    "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
    On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
    Seems to be your standard response to anyone you disagree with. Go
    back under
    your bridge.


    Really? Why do you have a hatred for say, IOCP? If so, you must also
    HATE AIO, or io_uring?

    I never mentioned IOCP but looking at it, yeah, looks like your standard >>> Windows approach of chucking threads at everything.


    Huh? You mean a thread pool, sometimes we can oversubscribe and use
    hardware threads * 2

    I don't care if its a thread ocean, its still threads being used where they're
    possibly not needed. Obviously depends on load. But if I'm writing a client such as ssh where the only I/O is via stdin and the socket I'm going to multiplex them in select() or poll(), not have 2 seperate threads.

    I don't think you should mock IOCP. Then you would be mocking AIO, or
    io_uring.

    I don't give a toss about IOCP, its a windows thing.
    I sometimes just reserve space in the page file and let the OS lazy write/read.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Chris M. Thomasson@chris.m.thomasson.1@gmail.com to comp.lang.c++ on Sat Nov 7 12:19:44 2026
    From Newsgroup: comp.lang.c++

    On 11/7/2026 10:20 AM, Michael S wrote:
    On Sat, 7 Nov 2026 01:17:19 -0000 (UTC)
    antispam@fricas.org (Waldek Hebisch) wrote:

    In comp.lang.c++ Michael S <already5chosen@yahoo.com> wrote:
    On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
    boltar@caprica.universe wrote:

    On Sun, 1 Nov 2026 21:59:41 +0200
    Michael S <already5chosen@yahoo.com> gabbled:
    On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
    boltar@caprica.universe wrote:
    On this one where you see code that is only multithreaded in
    order to serve individual sockets, not because it needs to be.


    That's because many people unable to implement state machines. Or
    able, but don't like them.
    It has nothing to do with availability and functionality of
    select/poll on Windows.

    Last time I had the misfortune to use win32 it couldn't multiplex
    on sockets.


    That's nonsense. That part of Winsock2 API did not change since
    1993. That is, in early 2000s they added poll() (WAASAPoll), but
    select() is the same BSD select() from the very beginning, just a
    little easier to use than original, because nfds is DNC.
    Now, if you woulds say that on Winsock2 select() can't multiplex
    waiting for socket I/O with waiting for other sorts of I/O (files
    and pipes) then your statement would make more sense*.
    But it does not sound like you really want to make sense. You
    strongly prefer mindless bashing.

    ----
    * - Although,
    1) of course, there (in Win32) exist not too complicated alternative
    methods to achieve such multiplexing as well. Just not via select().
    2) today, with nearly all file I/O deeply cached, multiplexing
    waiting for file I/O with waiting for sockets is a bad idea. OTOH,
    Multiplexing sockets with pipes could still make sense,
    infrequently.

    Just curious how you solve problem of blocking in single threaded
    program?

    I don't.
    If it is important and I expect that file operation will take
    significant time then I do it in another thread.
    May be, if I were doing server-side I'd treat it differently, but on
    cleent it's unlikely that I don't have more hardware threads than work
    to do, so separate thread is just right thing to do in such case.
    Assuming, of course, that performance at all matters, which is uncommon.


    AFAIK to get data from disc one needs about 10ms or possibly
    more, which is pretty long time on modern machines.

    I absolutly do not care about spinning rust. For close to 15 years.

    Do you assume
    that all data that you need is in RAM (or will be after short startup
    time)?


    In practice, it's extremely likely that all data is in system's file
    cache, i.e. in RAM.

    In say, IOCP, AIO, etc, we can use a single thread to handle that, no
    problem. But you will lose the concurrency the system provides. We can intermix file io and socket io. No problem.

    --- Synchronet 3.22a-Linux NewsLink 1.2