On 10/23/26 02:34, David Brown wrote:
On 23/10/2026 05:21, Lawrence D?Oliveiro wrote:
On Thu, 22 Oct 2026 15:41:15 -0500, Lynn McGuire wrote:
I have been advocating for quite a while that C++ should add a user
interface programming model for quite a long time.
First they need a standardized graphics API.
I hope that never happens.˙ There are large numbers of graphics APIs,
with huge ranges of what they support, how they work and their balance
between features, efficiency, portability, size, hardware support, and
what they are used for.
People who think C++ should have a standardised graphics API usually
mean they want to standardise the API they use on the one application
type that they write.
I gather there?s been a proposal that?s been kicking around for some
years, to adopt something based on Cairo
<https://www.cairographics.org/>.
You need something with subsets. At least a "basic" subset, a "full"
subset, and something in between that satisfies most uses. Or maybe
subsets for different purposes, but they should all be compatible.
On 10/23/26 02:45, David Brown wrote:
On 23/10/2026 08:25, Lawrence D?Oliveiro wrote:
On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:
On 10/22/2026 8:19 PM, Lawrence D?Oliveiro 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 you?re 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?
I?m assuming that all that BASIC programming hasn?t got to your head,
and you?re 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 :
˙˙˙˙˙typedef struct data_struct { int a; int xs[20]; } S ;
˙˙˙˙˙S build_some_data(void) {
˙˙˙˙˙˙˙˙ S s;
˙˙˙˙˙˙˙˙ s.a = 123;
˙˙˙˙˙˙˙˙ for (int i = 0; i < 20; i++) s.xs[i] = i;
˙˙˙˙˙˙˙˙ return s;
˙˙˙˙˙}
˙˙˙˙˙void foo() {
˙˙˙˙˙˙˙˙ S s = build_some_data();
˙˙˙˙˙}
then it is typically handled as though you had written :
˙˙˙˙˙void build_some_data(S * p) {
˙˙˙˙˙˙˙˙ p->a = 123;
˙˙˙˙˙˙˙˙ for (int i = 0; i < 20; i++) p->xs[i] = i;
˙˙˙˙˙˙˙˙ return;
˙˙˙˙˙}
˙˙˙˙˙void foo() {
˙˙˙˙˙˙˙˙ S s;
˙˙˙˙˙˙˙˙ build_some_data(&s);
˙˙˙˙˙}
That is - the caller creates the /space/ for the returned object, but
does not do any kind of initialisation.˙ 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,
On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:42 PM, Lawrence D?Oliveiro wrote:
On Fri, 23 Oct 2026 13:56:49 -0700, Chris M. Thomasson wrote:
On 10/23/2026 12:19 PM, Lawrence D?Oliveiro wrote:
In short, the concept doesn?t 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 ...
I?m sure it?s *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
don?t 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 implementor?s 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.
On 10/23/2026 8:33 PM, Lawrence D?Oliveiro wrote:
On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:42 PM, Lawrence D?Oliveiro 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 don?t 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 implementor?s 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.
Or what about miniaudio?s ma_engine_get_heap_size plus ma_engine_init_preallocated
On Fri, 23 Oct 2026 21:00:30 -0000 (UTC), Thomas Koenig wrote:
I have one Fortran program which has an excellent graphics API, it
writes Postscript. Works fine. Can't do any mouse clicks on it and
expect anything to happen, though :-)
PostScript was a very influential graphics API, but it is only fit for
the museum nowadays. It was designed for putting marks on paper, not
for updating pixels on a computer screen.
On Fr 23 Okt 2026 at 22:49, Lawrence D?Oliveiro wrote:
PostScript was a very influential graphics API, but it is only fit
for the museum nowadays. It was designed for putting marks on
paper, not for updating pixels on a computer screen.
There was also display postscript from SUN.
On Sun, 25 Oct 2026 16:31:56 +0100, Andreas Eder wrote:
On Fr 23 Okt 2026 at 22:49, Lawrence D?Oliveiro wrote:
PostScript was a very influential graphics API, but it is only fit
for the museum nowadays. It was designed for putting marks on
paper, not for updating pixels on a computer screen.
There was also display postscript from SUN.
Display PostScript was from Adobe.
You could be thinking of NeWS, which was from Sun. It slightly
predated X11, and they pretty much abandoned it after adopting X11
wholesale, like the entire rest of the Unix industry.
But neither Display PostScript nor NeWS made any changes to the
PostScript graphics model; it was still designed around making marks
on paper, not for updating pixels on a computer screen.
On 10/22/2026 8:19 PM, Lawrence D?Oliveiro 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 you?re 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.
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?
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?
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 don?t have to worry about it.
In short, it?s an abstraction that leaks that you accept only because
you have to, not because it?s 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 ?Nassi-Shneiderman diagram?. 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.
A caller provided buffer is normal with a lot of API's out there.
Managing the memory is the caller?s job in C anyway.
A lib that never allocates behind your back is what you
want in embedded, kernel, and arena code ...
I distinctly recall working with Sweet-16 on my ][+ back in the day,
but can't recall the details.
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 don?t 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.
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 isn?t. It?s 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.
That?s a dumb way to design things.
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the caller?s job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
On 10/25/2026 8:40 PM, Lawrence D?Oliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the caller?s 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?
On 10/25/2026 8:40 PM, Lawrence D?Oliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the caller?s 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?
HUH? How do you call say, fread without a user provided buffer?
If you need dynamic memory fine.
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?
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??
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?
On 26/10/2026 21:29, Chris M. Thomasson wrote:
On 10/25/2026 8:40 PM, Lawrence D?Oliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the caller?s 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.
On 10/26/2026 2:45 PM, Lawrence D?Oliveiro 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?
On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
On 10/26/2026 2:45 PM, Lawrence D?Oliveiro 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 ?Managing the memory is the caller?s job in C anyway.? You
didn?t say ?could be the caller?s job? as in ?the caller could have a choice?, you said ?*is* the caller?s job?. No choice. I.e. the caller
*must* manage memory.
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the caller?s job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
On 10/26/2026 2:45 PM, Lawrence D?Oliveiro 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 ?Managing the memory is the caller?s job in C anyway.? You
didn?t say ?could be the caller?s job? as in ?the caller could have a choice?, you said ?*is* the caller?s job?. No choice. I.e. the caller
*must* manage memory.
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 D?Oliveiro wrote:
On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:
On 10/22/2026 8:19 PM, Lawrence D?Oliveiro 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 you?re 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?
I?m assuming that all that BASIC programming hasn?t got to your head,
and you?re 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 :
˙˙˙˙˙typedef struct data_struct { int a; int xs[20]; } S ;
˙˙˙˙˙S build_some_data(void) {
˙˙˙˙˙˙˙˙ S s;
˙˙˙˙˙˙˙˙ s.a = 123;
˙˙˙˙˙˙˙˙ for (int i = 0; i < 20; i++) s.xs[i] = i;
˙˙˙˙˙˙˙˙ return s;
˙˙˙˙˙}
˙˙˙˙˙void foo() {
˙˙˙˙˙˙˙˙ S s = build_some_data();
˙˙˙˙˙}
then it is typically handled as though you had written :
˙˙˙˙˙void build_some_data(S * p) {
˙˙˙˙˙˙˙˙ p->a = 123;
˙˙˙˙˙˙˙˙ for (int i = 0; i < 20; i++) p->xs[i] = i;
˙˙˙˙˙˙˙˙ return;
˙˙˙˙˙}
˙˙˙˙˙void foo() {
˙˙˙˙˙˙˙˙ S s;
˙˙˙˙˙˙˙˙ build_some_data(&s);
˙˙˙˙˙}
That is - the caller creates the /space/ for the returned object, but
does not do any kind of initialisation.˙ 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.
On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
Or what about miniaudio?s ma_engine_get_heap_size plus
ma_engine_init_preallocated
No idea about that, but the same principle would apply.
On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
Or what about miniaudio?s ma_engine_get_heap_size plus
ma_engine_init_preallocated
No idea about that, but the same principle would apply.
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.
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
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.
On 2026-10-26 17:45, Lawrence D?Oliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s 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().
On 10/27/26 08:00, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence D?Oliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s 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.
On 2026-10-26 17:45, Lawrence D?Oliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s 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"..
On 2026-10-25 20:42, Lawrence D?Oliveiro 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?
On Tue, 27 Oct 2026 11:00:08 -0400, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence D?Oliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s 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 what?s being said in the parts you
quoted, never mind the parts you didn?t. Note my remark above about
?solving the resource allocation problem?; elsewhere I asked: ?What if
you?re building an object that needs to be returned to the caller??
Not clear yet what we?re talking about here? We?re not talking about
random API calls, we?re talking about libraries that need to create
and manage abstract objects that encapsulate the function they are
providing!
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:No, none of those comments appear anywhere in this sub-thread as
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
That?s just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* ?What if you?re building an object that needs to be returned to the
caller??
* ?The principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.?
* ?If you have to do cleanup at each level before exiting, then it works
perfectly well.?
Did you notice any of that?
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.
That?s just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* ?What if you?re building an object that needs to be returned to the
caller??
* ?The principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.?
* ?If you have to do cleanup at each level before exiting, then it works
perfectly well.?
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?
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.
That?s just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* ?What if you?re building an object that needs to be returned to the
caller??
* ?The principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.?
* ?If you have to do cleanup at each level before exiting, then it works
perfectly well.?
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?
?The end of software secrecy is almost upon us. The death of closed
source, and the final triumph of open source. ? -Eric S. Raymond.
The trend nowadays is to revive the old coroutine concept, in a new
guise called ?stackless? coroutines. These give you support for async >operations, but with transfers of control being made explicit at
?await? points, rather than unpredictably as with full preemptive
threading. This greatly reduces the opportunity for race conditions.
Credit to Microsoft for pioneering this, but nowadays you see the idea >popping up in JavaScript and Python and who knows where else.
Here?s 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.
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
Here?s 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.
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=20
EINPROGRESS error. But in fact, the connection attempt gets
initiated, and you can monitor its subsequent progress from your
event loop. =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 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=20
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
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.
?The end of software secrecy is almost upon us. The death of closedI have provided Claude Code with snippets of code?roughly a screen's
source, and the final triumph of open source. ? -Eric S. Raymond.
˙˙ https://www.battleswarmblog.com/?p=73639
"I should have realized this a few months ago when I successfully
decompiled the game of Firefighter from an ancient DOS shareware binary.
My robot friend was able to tell it had been written in Borland Pascal
from looking at the data layout; it gave me back very readable Pascal
code with sensibly chosen function and variable names. I transpiled it
to Rust and now ship it as part of my heritage games collection."
Huh, so somebody has actually built a decent decompiler.˙ Why do I doubt this even though ESR says otherwise?
And he has a translator from Borland Pascal to Rust?
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.
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.
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.
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=20
initiated, and you can monitor its subsequent progress from your
event loop. =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.
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.
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.
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.
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?
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.
On 2026-11-02, boltar@caprica.universe <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.
By "multiplex on sockets" do you mean supporting more then one connection
on a single socket? Serious question here: could you tell me how this can
be useful?
On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
boltar@caprica.universe wrote:
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*.
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.
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=20
initiated, and you can monitor its subsequent progress from your
event loop. =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?
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=20
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
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.
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=20
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
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.
On Mon, 02 Nov 2026 16:51:47 GMT
Charlie Gibbs <cgibbs@kltpzyxm.invalid> gabbled:
On 2026-11-02, boltar@caprica.universe <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.
By "multiplex on sockets" do you mean supporting more then one connection
on a single socket? Serious question here: could you tell me how this can >> be useful?
No I don't mean that and I can't be bother explaining what multiplexing means to someone who's clearly never used it.
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.
Peter Flass <Peter@Iron-Spring.com> writes:
On 10/27/26 08:00, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence D?Oliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence D?Oliveiro 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 isn?t. It?s 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.
That?s 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).
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?
On 11/4/26 09:48, boltar@caprica.universe wrote:
On Mon, 02 Nov 2026 16:51:47 GMT
Charlie Gibbs <cgibbs@kltpzyxm.invalid> gabbled:
On 2026-11-02, boltar@caprica.universe <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.
By "multiplex on sockets" do you mean supporting more then one connection >>> on a single socket? Serious question here: could you tell me how this can >>> be useful?
No I don't mean that and I can't be bother explaining what multiplexing means
to someone who's clearly never used it.
Don't be so smug. You could at least give him a hint.
If you bother enough to reply, you might as well show
that you know.
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.
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.
On Wed, 4 Nov 2026 10:56:20 -0800I sometimes just reserve space in the page file and let the OS lazy write/read.
"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.
On Wed, 4 Nov 2026 11:24:54 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 11/4/26 09:48, boltar@caprica.universe wrote:
On Mon, 02 Nov 2026 16:51:47 GMTsockets.
Charlie Gibbs <cgibbs@kltpzyxm.invalid> gabbled:
On 2026-11-02, boltar@caprica.universe <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
By "multiplex on sockets" do you mean supporting more then one
connection
on a single socket?˙ Serious question here: could you tell me how
this can
be useful?
No I don't mean that and I can't be bother explaining what
multiplexing means
to someone who's clearly never used it.
Don't be so smug. You could at least give him a hint.
If you bother enough to reply, you might as well show
that you know.
Right, because typing "IO multiplexing" into google or an AI is such an arduous task.
On 11/4/26 17:24, boltar@caprica.universe wrote:
On Wed, 4 Nov 2026 11:24:54 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 11/4/26 09:48, boltar@caprica.universe wrote:
On Mon, 02 Nov 2026 16:51:47 GMTsockets.
Charlie Gibbs <cgibbs@kltpzyxm.invalid> gabbled:
On 2026-11-02, boltar@caprica.universe <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
By "multiplex on sockets" do you mean supporting more then one
connection
on a single socket?? Serious question here: could you tell me
how this can
be useful?
No I don't mean that and I can't be bother explaining what
multiplexing means
to someone who's clearly never used it.
Don't be so smug. You could at least give him a hint.
If you bother enough to reply, you might as well show
that you know.
Right, because typing "IO multiplexing" into google or an AI is
such an arduous task.
That's fine too, as a hint, no issue there.
'Multiplexing' is a copiously overloaded concept, so a little
bit of help to steer him into the right direction is not out
of place.
Let's leave it at that.
Jeroen Belleman
On Wed, 4 Nov 2026 23:53:55 +0100
Jeroen Belleman <jeroen@nospam.please> wrote:
'Multiplexing' is a copiously overloaded concept, so a little
bit of help to steer him into the right direction is not out
of place.
=20
Let's leave it at that.
=20
Jeroen Belleman
Unless you didn't pay attention yet, boltar is asshole and proud at
that.
Or arshole? I'm not sure what is a correct spelling in his area.
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.
In comp.lang.c++ Michael S <already5chosen@yahoo.com> wrote:
* - 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? AFAIK to get data from disc one needs about 10ms or possibly
more, which is pretty long time on modern machines. Do you assume
that all data that you need is in RAM (or will be after short startup
time)?
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?
AFAIK to get data from disc one needs about 10ms or possibly
more, which is pretty long time on modern machines.
Do you assume
that all data that you need is in RAM (or will be after short startup
time)?
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.
On Sat, 7 Nov 2026 01:17:19 -0000 (UTC)
antispam@fricas.org (Waldek Hebisch) wrote:
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.
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.
| Sysop: | Tetrazocine |
|---|---|
| Location: | Melbourne, VIC, Australia |
| Users: | 3 |
| Nodes: | 8 (0 / 8) |
| Uptime: | 51:06:28 |
| Calls: | 223 |
| Files: | 21,513 |
| Messages: | 83,422 |