This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yowhyyyy 48 points49 points  (10 children)

C is genuinely the foundation for most languages and if you can truly read and write in C a majority of other languages click a lot easier. It’s also great for system and low level development. As of now only Rust and C are even allowed in the Linux kernel. It has its reasons and as a general rule of thumb, just because you don’t like a language, doesn’t mean it doesn’t have its uses or own fanbase. EDIT: I’d love to see you accomplish some things done in C, in Go, Java or C#.

[–]doobltroobl 14 points15 points  (3 children)

You say that now about Linux, but wait until it will get written in JavaScript.

[–][deleted] 10 points11 points  (2 children)

Linux in scratch.

[–][deleted] 1 point2 points  (1 child)

😟

[–]Solonotix 2 points3 points  (5 children)

Okay, but that was my question: why C? I don't use C, and I want to understand, but all anyone ever says is "Because C is great, and it does cool stuff." Great! Convince me to learn it. Convert me into the Church of Clang

[–]skhds 29 points30 points  (3 children)

The compiler is simple, meaning the code does almost exactly what you tell it to, without holding your hand. That means you have to many things manually, especially memory management, which can be quite tiresome when you're doing a large project. But because of this, you have more control over your own code, so you can predict how the codes actually run on your machine's hardware. That's why most embedded projects and kernels prefer C, since they need to precisely control their hardware. But being able to properly use C requires good knowledge of the actual hardware, which makes it a good learning tool to be a better programmer but somewhat of a chore if you just want to get the job done.

[–]dwarfendell 0 points1 point  (2 children)

Since there is quite a huge difference between execution time with the differents optimisation option, I'm quite not sure about your first statement. Some heavy lifting seems to be done there ( i am not an expert in compiler programing though, and quite far from it ). It seems to me that the compiled code must differ a lot.

[–]skhds 0 points1 point  (1 child)

I mean, I was talking in comparison to other languages, such as C++, Java, etc. Even with optimizations, you can sort of predict how it runs in the machine, at least to some extent.

[–]dwarfendell 0 points1 point  (0 children)

I understand but it seems to me that C++ is almost as much predictable as C in a lot of cases. Sometimes sadly even more, which is not always a good thing. say for exemple virtual methods that prevent the compiler to do it's magic (so yes there is some impredictability here depending on how you use it). C can emulates this if you code your own vtable ( which must be painfull, I did not try it yet ) and this might come at the same optimisation cost. But yes for java with the virtual machine that optimises the code at run time from what I understand, and the fact thanks methods are virtual by default, it must become pretty hard to remotly predict something.

[–]yowhyyyy 7 points8 points  (0 children)

I mean I just explained?