Live data from Hacker News

The Unreasonable Effectiveness of C

damienkatz.net

381–390 of 394 posts

Re: The Unreasonable Effectiveness of C

#381

Earlier quoted context omitted.

Macports is my tool of choice, but yes it's the only way to get things done! Unfortunately, plenty of scientific libraries are too obscure to be ported, leaving it to us scientists... Interesting what you say about 10.8 - I might give it a shot then. I will be upgrading soon from snow leopard (2009 MBP) and I was going to wipe and go debian/XFCE, because of all the "new ideas" like "let's not have save as" etc, but i…

Oh no, I think slapping linux on it is the way to go, don't get me wrong :) But I got stuck with it because I had to do ios dev at some point, so I learned to adapt ... I hear arch and ubuntu both work great out of the box on macbooks.

hmm, If I can get Arch to install, I might give it a go. Ubuntu was a bit pants when I tried it for a month early last year (had installed Lion, was pants on the old machine, tried ubuntu before rolling back to SL.) Multitouch gestures for multiple desktops is a must now that I've got used to it...

Re: The Unreasonable Effectiveness of C

#382

Earlier quoted context omitted.

Macports is my tool of choice, but yes it's the only way to get things done! Unfortunately, plenty of scientific libraries are too obscure to be ported, leaving it to us scientists... Interesting what you say about 10.8 - I might give it a shot then. I will be upgrading soon from snow leopard (2009 MBP) and I was going to wipe and go debian/XFCE, because of all the "new ideas" like "let's not have save as" etc, but i…

I halfway solution I'm reasonably happy with is to have a VirtualBox install of Debian on top of OSX, and install most scientific libraries there. I've considered just wiping and installing Debian as the main OS, but when I first looked the Linux driver support for my MBP wasn't great, and since then I just haven't gotten around to it. VirtualBox works fine for anything that isn't too heavy duty, and anything heavy-d…

This is a good idea. The problem I have is that I sometimes need basically all my RAM for simulations (yes, occasionally even on my laptop) and my current only has 4GB (with OS X eating up about 1.5GB on startup for "kernel tasks") so it's dangerous to run a VM with more than 2GB. New laptop will def have 8GB though, so this solution becomes viable again, thanks :)

Re: The Unreasonable Effectiveness of C

#383
post #3

To nitpick on a single statement: > C has the fastest development interactivity of any mainstream statically typed language. What? Despite all its shortcomings, Java in a modern IDE effectively has zero build time. The level of interactivity is as fast as that of interpreted languages. I haven't seen anyone manage this with C yet.

I'd rather have a Repl than a "modern IDE". C does not have or need a Repl because it's not designed for giant single programs anyway. Unix is the C Repl.

How is a unix shell going to help me debug the internals of my C program? You can use gdb from a terminal of course (yet another giant single program, funny how many of those I use every day…) but it's much more of a pain than a real REPL.

I noticed in another comment you said you are just learning C, perhaps you should wait till you have written non-trivial C before you declare what tools one does or does not need when writing it? C makes it very easy to make very nasty mistakes, so personally I take all the help I can get. I guess this means you think I'm an awful developer (according to your recent anti-IDE blog post), but I'd rather have code with less bugs than worry about violating some notion of 'purity' or hacker-hardcorness.

Re: The Unreasonable Effectiveness of C

#385

Earlier quoted context omitted.

Sorry, I don't see that. What he said is clear to me: The C virtual machine does not provide an accurate model of why your code is fast on a modern machine. He's saying that the abstraction that C provides has deviated significantly from the underlying hardware. Considering the kinds of hoops that modern processor go through, this is a valid point. And the above should answer the sibling's question, too.

He also said "C runs on many systems with noncontiguous memory segments but presents it as a single contiguous space." That is 100% false. In C, pointers to different objects are different. They're not even comparable. There is no concept of contiguous memory beyond that of a single array. Two arrays are not contiguous.

Allocate an array that crosses segments. Watch the details be hidden from you.

Re: The Unreasonable Effectiveness of C

#386

Earlier quoted context omitted.

None of what you said supports your initial claim that the author is ignorant. In fact, even if we pretend that everything you said is true, none of it contradicts the article, or the authors conclusions. Yes, C has lots of areas where other languages are better. And yet, it is still the most practical language to use because of the combination of things that it does well.

"it is still the most practical language" Only in extremely limited contexts: low-level code for operating systems that happened to have been written in C. Otherwise, there is a better language for pretty much every use-case of C.

No, there isn't. What would you write a database in? Or an SMTP server, or IMAP, or HTTP, or whatever else. There's a reason all that stuff is almost always done in C.

Re: The Unreasonable Effectiveness of C

#387

Earlier quoted context omitted.

low-level code for operating systems that happened to have been written in C You say that like it is an accident that just about every major OS today is written in C or C/C++

"You say that like it is an accident that just about every major OS today is written in C or C/C++" Is there some technical feature of C or C++ that makes those languages good for writing OSes, or that made OSes written in those languages overwhelmingly successful? You might argue that the simplicity of a C compiler made Unix successful because it helped with portability, but C is by no means unique in this regard --…

One would be hard-pressed to argue that Windows won because C++ is a great language

I'm not arguing that. I'm not even saying I know precisely why C or C/C++ is good. I'm just saying, when every major OS is written in it, can you really dismiss it so easily?

Re: The Unreasonable Effectiveness of C

#388

Earlier quoted context omitted.

He also said "C runs on many systems with noncontiguous memory segments but presents it as a single contiguous space." That is 100% false. In C, pointers to different objects are different. They're not even comparable. There is no concept of contiguous memory beyond that of a single array. Two arrays are not contiguous.

Allocate an array that crosses segments. Watch the details be hidden from you.

I'm not aware of an implementation that does that, and it's not required by the standard. A more common solution is to just limit the size of an array to the size of a segment (sizet max would also then be the segment size). If you think the C standard requires crossing segments, what section, what words?

Re: The Unreasonable Effectiveness of C

#389

Oh for heavens' sakes. Yet more ignorance. A more realistic view of C: - C is straightforward to compile into fast machine code...on a PDP-11. Its virtual machine does not match modern architectures very well, and its explicitness about details of its machine mean FORTRAN compilers typically produce faster code. The C virtual machine does not provide an accurate model of why your code is fast on a modern machine. The…

Disclaimer: I am a C programmer. C is straightforward to compile on pretty much every single CPU out there. A C compiler is required to certify many very common CPU's before they go into manufacturing, in fact. You cannot go to silicon, in many fabs, unless you have demonstrated the CPU can handle code; most of the code doing all this testing, is in C (lots of Assembly too). C is a front-line language, at the fabrica…

Well put.

Re: The Unreasonable Effectiveness of C

#390

Earlier quoted context omitted.

problems should be solved by describing a linear sequence of steps (as opposed to logic/declarative programming) Linear sequences of steps processing data arrayed in some linear fashion or others is what computers do. It is certainly what a single core does. So you would rather have someone else write a C program for you that abstracts it away and calls it a new way to program? That's k, just know that you'll still h…

> Linear sequences of steps processing data arrayed in some linear fashion or others is what computers do No, it's what some computers do. It's almost certainly not what the computer you are using currently does. It's quite possible it's not what any computer you've ever used does. > So you would rather ... I'm not expressing a preference. If you think I was, you've misunderstood my comment. I'm making observations,…

How does this computer right here not consist of a whole lof of linear sequenceS?(notice the plural btw? and the fact that "linear" does say nothing about "serial" vs "parallel", either?) How is data not arrayed linearly? Please elaborate, "because I said so" is not enough.
Post reply on HN