4 ms·
C arrays suck on the best of days and qsort requires that you understand function pointers and types which are some of the hairiest C syntax in common use. The
by jjoonathan 3y ago
C arrays suck on the best of days and qsort requires that you understand function pointers and types which are some of the hairiest C syntax in common use. The C Clockwise Spiral rule is truly special.
It's easy to lose sight of the climb once you're at the top.
- JohnFen 3y agoWell, we could debate this, but it's all irrelevant to the assertion that C makes it hard to use good libraries.
- jjoonathan 3y agoOh, right, I forgot that C's library/package management situation sucks so hard that makes the awful syntax look like a comparatively small problem.
- JohnFen 3y agoThis actually made me laugh out loud. Yes, if your problem with C is that it doesn't need a package management mechanism like some other languages, then C is clearly not for you. But C is very far from the only language like this. It's a bit like criticizing a fish for having no legs.
- IshKebab 3y ago> if your problem with C is that it doesn't need a package management mechanism like some other languages The problem isn't that it doesn't need one, it's that it doesn't have one. I have no idea why you would think that it doesn't need one. Well there is vcpkg now anyway so it finally does have one.
- JohnFen 3y agoI sense that we have some sort of real miscommunication going on here, because the only response I can think of to > I have no idea why you would think that it doesn't need one. Is that I have no idea why anyone would think that it does need one. Perhaps the disconnect is that you are wishing C addresses different use cases than it addresses? That you wish it were a different language? If so, that's fine. Use a more appropriate language for your task. I just find it odd if the criticism of C is that it isn't a different kind of language.
- IshKebab 3y ago> Is that I have no idea why anyone would think that it does need one. For the same reason any language needs one. What is it about C that you think excludes it from the basic requirement of "using third party libraries"?
- cozzyd 3y agoC package management works great on my system. # dnf install foo-devel
- IshKebab 3y agoThat's suboptimal for many reasons. Package names are not consistent. Installing multiple versions is usually impossible. Huge pain for library authors. Doesn't integrate with build systems usually (even basic pkg-config support is iffy). The command is OS-specific. You can't usually choose the linking method. Difficult to bundle dependencies. Usually out of date. Etc. etc.
- cozzyd 3y agoit works quite well in practice, and unlike pip things don't break every 2 weeks.
- devnullbrain 3y agoI'd suspect kernel devs know about function pointers.
- jjoonathan 3y agoI'd expect kernel devs to carry lots of bad habits and poorly calibrated intuition from their noob days. Example: "for loops are fine."
- sgerenser 3y agoWhat’s wrong with for loops?
- jjoonathan 3y agoThey encourage accidentally quadratic behavior if they are easier than calling sort().
- asveikau 3y agoA lot of these comments are like "C is hard if you don't know C and it scares you". Not to mention kernel mode doesn't want a gigantic library package manager to pull in leftpad() from the internet. As mentioned, the kernel libraries on FreeBSD have a qsort, but they didn't in the original commit from 3 decades ago or whatever.