News for hackers. Stuff that matters.
Re:The Unreasonable Effectiveness of C by meaty on Thursday January 10, 2013 @10:41AM (#5037456)
That's why we have valgrind and glib.

At the core, a good language shouldn't really have any of these things you say built in - they should be built on top of the language itself.

Re:The Unreasonable Effectiveness of C by rayiner on Thursday January 10, 2013 @10:42AM (#5037467)
Having strings, containers, etc, not built into the language itself means that you can't practically use them. Libraries will all have their own incarnations, and as a result you get stuck dealing with the lowest common denominator of C arrays.
Re:The Unreasonable Effectiveness of C by oinksoft on Thursday January 10, 2013 @10:54AM (#5037554)
Re:The Unreasonable Effectiveness of C by rayiner on Thursday January 10, 2013 @11:07AM (#5037644)
The problem is choice. If you're writing a library, no matter which containers you choose you'll have users that chose differently. So you either require full buy-in for your framework (like GTK does with GLIB) or you end up exposing the lowest common denominator of functionality (C strings and arrays).
Re:The Unreasonable Effectiveness of C by jlgreco on Thursday January 10, 2013 @03:28PM (#5039534)
I've long been a diehard C fan, and I still jump at the opportunity to use it, but the realization that choice can be harmful has gradually pushed me away from C.

The problem of choice with libraries is really only the beginning though. Coding style/formatting choice, language feature choice (infamously an issue with C++; which subset of the language to use is the source of most trouble in C++ teams in my experience), build system choice, etc are all sources of trouble. Most modern languages cover some of these with various effectiveness, but miss others. Unfortunately, the popular modern languages seem to do rather poorly in these areas.

I find either extreme comforting. The reckless freedom that C offers is alluring, but the bondage of a batteries included language with strong idioms covering the entire system makes for better programmers.

Re:The Unreasonable Effectiveness of C by oinksoft on Thursday January 10, 2013 @11:48AM (#5037979)
And so this buy-in occurs at the library level rather than the language level. One might see that as a good thing.
Re:The Unreasonable Effectiveness of C by rayiner on Thursday January 10, 2013 @12:46PM (#5038449)
Those people would be wrong. When buy-in occurs at the library level, then the de-facto response is to fall back to the lowest common denominator, whatever that happens to be. In a language with standard containers, that lowest common denominator is a reasonable floor. Having containers in the standard library has basically zero downside aside from some perceived conceptual elegance. People who need custom containers can always define their own. People who just need to get a string from point A to point B, where A and B are libraries written by different people, can easily do so by falling back to the standard containers.
Re:The Unreasonable Effectiveness of C by dmpk2k on Thursday January 10, 2013 @08:58PM (#5040933)
I agree with this so much. A few years ago I realized that my C code wasn't longer or harder to reason about than most higher-level languages (yes, that factors in the memory management and even error checking), except for one thing: those languages came with built-in resizable arrays and hash tables.

I was grossly disappointed when the C11 revision had nothing about some default algorithm implementations in the standard library. If a C hacker needs something more specialized than those default containers, they can go write their own (they would have anyway), but for the rest of us it allows getting something reasonable off the ground relatively quickly.

APR and Glib are nice in theory, but most software shouldn't require such dependencies. Also, every C hacker I've spoken to has a different opinion about the quality and usefulness of those two libraries; most dislike the two.

Re:The Unreasonable Effectiveness of C by mpyne on Thursday January 10, 2013 @11:04AM (#5037628)
That's kind of the point. Why do you have to choose? Why isn't it possible with the language and its standard libraries? What happens when you mix APR code with glib-using code?
Re:The Unreasonable Effectiveness of C by matthiasv on Thursday January 10, 2013 @12:04PM (#5038112)
1. Because there is no standard defining that. 2. Because there is no standard defining that. 3. Nothing. Functions in both libraries are prefixed to avoid name clashes.
Re:The Unreasonable Effectiveness of C by mpyne on Thursday January 10, 2013 @12:54PM (#5038499)
The lack of standard for 1+2 is the complaint here. Prefixing in the libraries is a workaround to make it possible at all for their separate (but similar) basic types to co-exist, but the libraries shouldn't have to define sane basic types for these things. At most they should have to add extended operations.

But because they don't, it must be reimplemented in each library that needs them, which adds to code size and semantic overhead. Which might be helpful is for a good basic type library to be created which could be a common dependency for each (perhaps host it on CCAN), but the fact that this would be needed at all is the base complaint.