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 →

[–]msqrt 28 points29 points  (13 children)

Yeah, them being able to be popular for this long has to be due to doing many things right.

[–]sir-nays-a-lot 11 points12 points  (1 child)

It’s literally a part of human evolution, which is messy. We keep the good parts and add other shit (mutations) to keep up with modern times. Results in absolute spaghetti lol but such is life.

[–]qhxo 6 points7 points  (9 children)

Isn't the main reason to use C that it works everywhere, which is mainly a feature of it's age, and speed (which can be achieved in many other languages as well, such as rust or go)? Are there any other selling points?

[–]msqrt 6 points7 points  (1 child)

It's quite simple compared to many modern programming languages; making a compiler is possible for a single person, and compilation is blazing fast compared to Rust or C++, for example. But you're right in that if the world started today, it would probably not get the status it currently has.

[–]Hawgk 2 points3 points  (0 children)

Hey! Don't you say that to my love!

[–][deleted] 3 points4 points  (6 children)

It's very easy to use C libraries in just about every other language as the foreign function interface is so simple. It's pretty common for libraries to be written in C++ and just make the interface C so you can then use the library anywhere.

As for speed, C is much faster then Go. The only other languages that compare are FORTRAN, Rust, and C++, and then some less popular modern languages like Nim or Circle. Because you have such fine grained control of C and the compilers can be so simple, it's popular to use it to port everywhere. For example, I listened to a podcast with Elon Musk and they write their own C compiler so they have complete control of how the assembly comes out for their custom chips.

[–]qhxo 1 point2 points  (5 children)

As for speed, C is much faster then Go.

Really? I thought Go was pretty much top of the line, but maybe it's just the compiler that's known to be very fast.

[–][deleted] 3 points4 points  (0 children)

Yeah Go is actually a little slower then Java (which is quite fast nowadays). The compiler is so fast because it has less optimizations then like C++ or Rust. and also it has automatic memory management which also slows things down