5 ms·
Imo the middle ground here is that this is a common enough operation that it should be in your language's standard library, see e.g. [0][1]. And if you have to
by lawl 5y ago
Imo the middle ground here is that this is a common enough operation that it should be in your language's standard library, see e.g. [0][1]. And if you have to use C, then yes, write it yourself or copy some other implementation with a compatible license. That's what you signed up for when you decided you need C.
[0] https://pkg.go.dev/os#MkdirAll https://pkg.go.dev/os#MkdirAll
[1] https://doc.rust-lang.org/std/fs/fn.create_dir_all.html https://doc.rust-lang.org/std/fs/fn.create_dir_all.html
- fivea 5y ago> Imo the middle ground here is that this is a common enough operation that it should be in your language's standard library, see e.g. [0][1]. Is it, though? I mean, C is around for around half a century, and C is perhaps the primary language in the FLOSS universe. Still, why is there no widely adopted idempotent directory tree creation library?
- mgaunard 5y agoBecause 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.
- fivea 5y ago> 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?
- mgaunard 5y agoHow 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.
- fivea 5y ago> 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?
- unionpivo 5y agoLibraries are a pain in C. So most C programs use less of them, than if you are writing js
- fivea 5y ago> 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?
- cowsandmilk 5y ago> 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.
- vlovich123 5y agoLet’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.
- fivea 5y ago> 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.
- vlovich123 5y agoThat’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.
- fivea 5y ago> 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?
- 5y ago