News for hackers. Stuff that matters.
Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @05:08AM (#29681951)
Because C stopped evolving long ago, in spite of the recent C standards that have more to do with a reanimated zombie than anything else.

In C++ that functionality is indeed part of the standard library.

Re:Fix the unit test and open a giant hole everywhere by vlovich123 on Saturday December 25, 2021 @11:24AM (#29684476)
Let’s not act so high and mighty. It got added in c++17 which is only four years ago and it took most implementations quite a while to implement it in the official <filesystem> location (vs as an experimental header).

Oh. And we’re still lacking any kind of sockets support. There’s this thing I’m hearing about called the Internet that’s going to be big any day now and might need this.

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @12:12PM (#29684863)
I fail to see how "any kind of sockets support" is true, given that there is a networking TS as well as well-established networking libraries.

The main reason why all these things haven't really been integrated into the main language yet is because the committee is still experimenting with various approaches to asynchronous programming and scheduling with goals of also integrating these with heterogeneous computing.

Also sockets are arguably an outdated networking model anyway, so people really serious about high-performance networking will be doing their own thing regardless.

Re:Fix the unit test and open a giant hole everywhere by vlovich123 on Saturday December 25, 2021 @12:43PM (#29685138)
I could buy that reasoning in the 90s. Heck even in 2000 after the dotcom bubble burst. I could maybe buy it in 2010 although by then networking was in no way even remotely niche. We’re now into the third decade of networking and far less important additions to the standard library have been made.

A TS is almost nothing in the c++ world. Each implementation will have its own quirks and unreliable cross platform behavior if it’s even available. There are well established filesystem libraries too (heck the STL implementation is almost identical to boost for that reason to make it easier for those people to port and for the library maintainers you basically just wholesale copy an implementation or at least have a reference one to test most things against).

> Also sockets are arguably an outdated networking model anyway, so people really serious about high-performance networking will be doing their own thing regardless.

I’m eager to hear what you mean by this because I’m unaware of any OS APIs that do Networking in any other way. Unless you’re talking about userspace drivers or DPDK, neither of which see serious adoption outside of data centers (if even there). 99.99% of an networking code I’ve observed across mobile and cloud is socket-based.

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @01:27PM (#29685610)
High-performance networking somewhat excludes mobile and cloud.

Regardless, the io_uring interface, which is general-purpose and still based on file descriptors for its initialization, does go out of its way to work around some of the problems with the socket model.

Re:Fix the unit test and open a giant hole everywhere by fivea on Saturday December 25, 2021 @11:38AM (#29684596)
> Oh. And we’re still lacking any kind of sockets support. There’s this thing I’m hearing about called the Internet that’s going to be big any day now and might need this.

Between libcurl, POCO, or even Qt, does it matter at all that the C++ standard offers "any kind of sockets support"?

Just because Java forced everything under the sun into their standard library, that does not mean that move makes any sense at all. Between Boost and Apache and POCO and others like that, it's high time we stop insisting in this nonsense.

Re:Fix the unit test and open a giant hole everywhere by vlovich123 on Saturday December 25, 2021 @12:32PM (#29685044)
That’s one position. The other is one most other languages choose which is some kind of cross platform sockets support out of the box with packages filling in more niche cases for performance or usability reasons.

You could easily make the same counter argument against including <filesystem> and yet there’s very real value to having something cross platform out of the box that handles elegantly various pitfalls that people typically fall into.

Re:Fix the unit test and open a giant hole everywhere by fivea on Sunday December 26, 2021 @06:18AM (#29691481)
> The other is one most other languages choose which is some kind of cross platform sockets support out of the box with packages filling in more niche cases for performance or usability reasons.

Given that Java followed that path and already acknowledged that mistake by deprecating the original HTTP client, why do people insist in not learning lessons?

Re:Fix the unit test and open a giant hole everywhere by vlovich123 on Sunday December 26, 2021 @10:47AM (#29693312)
HTTP != sockets. I’m not arguing for HTTP within the standard library but for low-level networking support. That one should be non controversial.

As for HTTP within the standard library, I would probably tend to agree although I’d note that Python does have it in its standard module set and I don’t think there’s an acknowledgement that that’s somehow a mistake. Each language fills a different need so framing it as “people insisting in not learning lessons” isn’t helpful. Not to mention that the best way to learn is to experiment and double check if what was once true remains that way (experts know when and in what way to break rules).

Re:Fix the unit test and open a giant hole everywhere by pjmlp on Sunday December 26, 2021 @10:38AM (#29693218)
Because what the standard library offers, is supposed to be available across all platforms and implementations of a specific language, with a certain expectation level in quality.

What is available as external library has various levels of support quality.

That is why we have POSIX, the C runtime that ISO C didn't want to rely on, yet almost every C program uses a part of it.

Re:Fix the unit test and open a giant hole everywhere by jstimpfle on Sunday December 26, 2021 @11:26AM (#29693718)
Pretty sure many or most Windows programs don't use the POSIX library.
Re:Fix the unit test and open a giant hole everywhere by pjmlp on Sunday December 26, 2021 @11:36AM (#29693824)
Indeed, there is a semantic difference between almost every and all of them.

Still it was deemed important enough to spend development resources on the POSIX subsystem to make DoD happy, then SFU and now integrate the Linux kernel.

Re:Fix the unit test and open a giant hole everywhere by jstimpfle on Monday December 27, 2021 @09:50AM (#29702890)
I don't think there is a need to bring up "semantics" here, and the only reasonably defined semantics that I know for the term "almost all" would be from set theory where that is a useless term without an infinite set to measure against.

Common sense anyway would suggest that "almost every" is distinct from "many, but also many not", and the latter is what I think would be a better fit here.

The intention behind my comment (and I thought it was clear without any "semantics" discussion required) was to show that there is no need for the POSIX layer to be included as part of ISO C. POSIX is just a "platform layer" (for all I know), meaning that it is much closer to a "library" than a "runtime". I don't see a need to bundle it tightly with the language. Heck, why did I even bring up Windows as a counterexample, when there are probably a lot of more-or-less ISO C conforming compilers for microcontroller platforms that could never support POSIX.

Re:Fix the unit test and open a giant hole everywhere by fivea on Saturday December 25, 2021 @05:30AM (#29682048)
> Because C stopped evolving long ago (...)

That excuse isn't credible. I mean, I asked about a libraries that handled that usecase, not a standard library. If there was demand for that use case, and that demand popped up so often that it justified the adoption of a de-facto standard, why isn't there any third-party library specialized in that usecase? I mean, putting together a library takes far less work than presenting a proposal to the C standardization committee, which is open to proposals.

So, why isn't there one? Might it be that there is actually no relevant demand for it?

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @06:13AM (#29682288)
How would such a trivial library achieve popularity? It would have to be part of a larger framework.

Anyway I just checked and Glib does seem to have it for example.

Re:Fix the unit test and open a giant hole everywhere by fivea on Saturday December 25, 2021 @06:16AM (#29682305)
> How would such a trivial library achieve popularity?

There is no size limit on how many features could ship with a library. In fact, we live in an age where packages like rimraff report around 50 million downloads per week.

But the original question, and the point it made,still stand: why isn't there such a library to provide such a feature? Might it be that you're overblowing it's demand and usefulness? Perhaps there is no such thing in the standard library because no one bothers with it, or feels it's missing?

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @07:24AM (#29682716)
I already gave you an example of a C library that provided that functionality.

And no, people don't reuse trivial libraries in C, this is not JavaScript.

Re:Fix the unit test and open a giant hole everywhere by fivea on Saturday December 25, 2021 @11:59AM (#29684757)
> And no, people don't reuse trivial libraries in C, this is not JavaScript.

You do realize that tribalist arguments based on absolutely no technical point whatsoever do not make any sense at all, don't you? I mean, who in their right mind would argue that only nodejs developers need to delete dirs?

And if you believe that putting together a reliable cross-platform library that handles idempotent directory creation then be my guest and just do it. How hard would it be, right?

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @12:16PM (#29684900)
This is merely a factual comment.

Node.JS is widely known for having people depend on trivial packages (I vaguely remember some story about half the world being affected because the package doing a trim space went down).

The same is not true for C. Libraries there tend to cover larger domains.

Whether that is caused by technical limitations, culture, or competence of the developers is all irrelevant to that statement.

Re:Fix the unit test and open a giant hole everywhere by rat9988 on Saturday December 25, 2021 @09:31AM (#29683593)
Cross plateform make directory is trivial?
Re:Fix the unit test and open a giant hole everywhere by unionpivo on Saturday December 25, 2021 @07:05AM (#29682599)
Libraries are a pain in C. So most C programs use less of them, than if you are writing js
Re:Fix the unit test and open a giant hole everywhere by fivea on Saturday December 25, 2021 @07:13AM (#29682651)
> Libraries are a pain in C.

They really aren't. At all. What exactly are the pain points you experienced with C libraries?

> So most C programs use less of them

This assertion doesn't hold any water. In all the years I worked with C and C++ projects, not even once did I ever heard "let's not add a library, it's hard".

Do you actually have a concrete, real issue in mind?

Re:Fix the unit test and open a giant hole everywhere by cowsandmilk on Saturday December 25, 2021 @08:29AM (#29683185)
> What exactly are the pain points you experienced with C libraries?

1. Varying build systems. Does the dependency use cmake? Autoconf? A shell script where you’re instructed to modify some variables specific to your system?

2. The above, but my software is shipping on Linux, windows, and Mac. What’s the best way to get this dependency compiled? Does upstream even support all these OSes?

In all my years of doing C programming, I’ve never seen some add a single function library like is_even and then another like is_odd. But you do see it in languages where it is really easy to add libraries.

Re:Fix the unit test and open a giant hole everywhere by convolvatron on Saturday December 25, 2021 @12:07PM (#29684820)
in C I always end up building my own world because the default one is broken. for example null terminated strings are just really awful to work with. i'm not alone - alot of larger C projects have their own runtime, particularly memory management. another cross-cutting concern is multihreaded safety and scheduling.

unless the library author broke those functions out, then I need to rehost it in my environment. so I usually end up forking any library that I want to use. this isn't all bad - I find some bugs and integrate the build. I adopt the library and develop and understanding of it sufficient to maintain it myself.

contrast that to a language environment where those things - strings and threads and build are all standardized.

Re:Fix the unit test and open a giant hole everywhere by mgaunard on Saturday December 25, 2021 @01:35PM (#29685689)
My point of view is that if you program in C you most likely care about being in control of what happens.

Your approach makes perfect sense within that context.