Live data from Hacker News

Learn C

medium.com

151–160 of 182 posts

Re: Learn C

#151

Earlier quoted context omitted.

Using functional paradigm with immutable types does take care of a lot of the complexities of parallel computing... It allows you to make a lot of assumptions (from the underlying platform's perspective) and can break up work in very interesting ways, not just across cpu cores, but even in distributed computing environments. If you combine this with a scriptable language, you can even carry the workload with the code…

The kicker for me that makes me think that working too hard to make easily parallelizable constructs isn't worth it is that communication is expensive and single cores are actually pretty darn powerful on their own. The implication is that you don't want to be parallelizing at too low a level. You want to be doing it at a much higher level if you possibly can. If you have an 8-core machine and thirty independent task…

You are missing the per-CPU parallelization via vectorization that lies at the core of every modern video decoding library. The conundrum with C is that it is one of the very few languages that allow (via assembler callouts) to directly use CPU vecorization instructions, but at the same time does so in a manner that absolutely prevents automatic optimizations (i.e. by observing data dependencies).

Re: Learn C

#152
post #98
post #84

Earlier quoted context omitted.

The parent poster asked for desktop software written in languages besides C or C++ without any reference of hybrid applications or timeframe when they were written. Since when desktop operating systems are not desktop applications? I can provide other examples, but most likely I will get extra requirements along the way, so why bother... After all, you can always use the argument that any application needs to call C…

What a victim complex. If someone is debating that we should stop using C, and I ask for software not written in C, it's obvious that I'm looking for contemporary software. And the reasoning that every software is "C" because it needs to do system/library calls would be ludicrous, and to provisionally accusing me of that is insulting. I've done some research myself, and there are some interesting and big projects in…

There is a lot of applications in C#, a lot in Java, a lot in full python (e.g. ubuntu utilities), some in flex (cheers to balsamiq the wonderful). The fact that you didn't installed them doesn't mean they aren't there. Moreover, you shouldn't say C/C++, they are very different languages and I can bet my hat that your desktop applications are full of C++ with an high level framework like Qt. Not really close to the metal.

Re: Learn C

#153

We need less code written in C, not more. We already have a problem with a massive, unreliable, insecure ecosystem of legacy C code that is hard to escape; writing more software in C makes that problem worse. Most software is written to solve high-level problems. Using a high-level language is sensible, time-saving, budget-saving, improves portability, and saves on headaches later. The same rule that applies to COBOL…

Not really. What we need is people not learning C (or any language) without also learning how writing it wrong causes defects. In my book (mentioned in the post) I have students using Valgrind and attempting to break their code starting at the 4th lesson. I also show them how and why to avoid defects in C. Instead of saying "no new C", we should probably be approaching it with a two-pronged attack. First, tracking do…

Thanks Zed, I really can't upvote you enough! I absolutely love the style of your writing, and the "hard-way" approach to teaching. Keep up the great work :-)

Re: Learn C

#154

Earlier quoted context omitted.

The control software for the Ariane rockets is written in Ada, which is apparently meant to be especially ‘secure’/predictable. And promptly blew up the rocket.

They took the code from the Ariane 4 and stuck it on the Ariane 5 assuming all would go fine. While a famous incident attributed to Ada, I can safely say that C and other popular languages have done far more damage. Even if not in terms of exploding rockets (I don't know), but time lost debugging, fiddling with checks that would be handled in other languages and so forth. I like to tell people with Ada I can spend my…

Is Ada worth learning?

Re: Learn C

#155
post #21

Earlier quoted context omitted.

Was there any study done to the (un)reliability of C? I know for a fact practically every piece software I use is programmed in either C or C++. The sole exceptions are Anki and Gentoo's portage system, both Python. And I'm pretty sure the reason portage is so extremely slow is because it is in Python (I've checked, it's not I/O-bound). And Anki is some very unreliable software. In fact, give me a single big desktop…

A major part of Firefox (hundreds of KLOC) is written in JavaScript. While the layout and network code is all C++, most parts that aren't performance-critical and don't need to interact directly with the OS are JS. This includes all of the high-level UI code.

And JS VM is written in C.

Re: Learn C

#156
post #57

Earlier quoted context omitted.

Agreed; OS kernels and firmware for embedded systems all require low-level access to hardware in a way that high-level desktop applications do not. Being able to easily reason about how C is going to use resources and be compiled down to machine code for the architecture you are using can sometimes be an important asset.

I think that the point is that even if you accept that the kernel level code and device drivers are all in C, from there, there's less and less benefit to doing userland code in C from there... you could use Lisp, Erlang, Scheme or a number of other languages for userland and service oriented code. Although I really don't care for Unity, or Windows 8's UI's I do appreciate some of the directions they are going in ter…

Foregoing application performance adds up to a lot of money for the likes of Google and Facebook in terms of server cost, cooling, size. Maybe Go will displace C at Google but I imagine only when it reaches performance parity.

Re: Learn C

#157
post #24

Earlier quoted context omitted.

"lisp compilers are the simplest to write" I think Forth may have that honor, and people have done some pretty amazing things with simple Forth implementations. I do agree, though, that writing a simple Lisp compiler is a worthwhile exercise, and the Lisp In Small Pieces is a book everyone should have on their shelf.

I would say Brainfuck is even easier.

Interpreter, sure. Why would a BF compiler be particularly easy?

Re: Learn C

#158
Thanks for this, I'm going to work my way through Learn C the Hard Way. I started on Java, but now I use a lot of Ruby and Python, and both of those languages' original/main implementations are both written in C, so I want to learn how C works.

Re: Learn C

#159
post #34

We need less code written in C, not more. We already have a problem with a massive, unreliable, insecure ecosystem of legacy C code that is hard to escape; writing more software in C makes that problem worse. Most software is written to solve high-level problems. Using a high-level language is sensible, time-saving, budget-saving, improves portability, and saves on headaches later. The same rule that applies to COBOL…

> We already have a problem with a massive, unreliable, insecure ecosystem of legacy C code A ton of the world's software with the highest reliability requirements is written in C and C++. Nuclear power plants? Yes. [1] Joint Strike Fighter? Yes. [2] Mars rover? Yes. [3] Your Tesla? Yes [4] US telephone systems. Stock exchanges. Bloomberg. Your cell phone OS (incl. many years before smartphones). The list goes on and…

Let me add in one:

[6] Fire Safety and Building Security Systems? Yes

Re: Learn C

#160
I agree with the original poster. Learning C definitely allowed me to understand (and feel) the code from the inside. If you just use a Hashmap or Array without knowing how you'd do it in C, you're just playing with Lego pieces. (I also agree with his view on C++ but I won't poke that hornet nest)
Post reply on HN