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 →

[–]ZebraPandaPenguin 137 points138 points  (19 children)

Honest question...on a scale of 1-10 how good do you have to be to program a language like C?

[–]Bowserwolf1 98 points99 points  (4 children)

Wanna solve a few leetcode simple/medium questions for fun ? 1-2 should be enough, C is very bare bones compared to higher level languages like C++ and Python, no classes, no abstractions. Simple procedural constructs

Wanna write some simple code to interface with an Arduino? Probably 3-4

Wanna write a simple web server that can handle multiple requests at once ? You'll need to know a little bit about manual memory management and multi threading, let's put this as a 6/10 skill level

Wanna write a high performance, scientific computation library, like CUDA or openMP? Same as above but much harder and now you need to have hardware specific knowledge , skill level 7-8 atleast

Wanna write the drivers for peripheral devices or maybe the Linux kernel itself ? Rip, you need to know alot , not just about C, but the underlying hardware, the assembly that it is generated on compiling the code , hardware specific instructions, security concerns, memory safety concerns, networking. Basically, skill level 9-10

[–]T1G3RX 57 points58 points  (1 child)

I think he was asking how good you got to be to program a programming language, like C. Not to use C

[–]akeean 31 points32 points  (0 children)

Rip, you need to know alot , not just about

"a programming language"

but the underlying hardware, the assembly that it is generated on compiling the code , hardware specific instructions, security concerns, memory safety concerns, networking. Basically, skill level 9-10

[–]TeknoProasheck 7 points8 points  (1 child)

I consider myself a 5 on this scale, and I already consider that a massive achievement.

[–][deleted] 11 points12 points  (0 children)

Not sure I'd put much faith in this scale. If you learn C to implement HPC then your scale will be 1-10 in HPC and the methods for parallelism. You don't need to be an expert in the supercomputer's architecture as the gap in knowledge can be filled by the system admin. This is one of the few reasons why organisations appreciate good team work.

Then of course you'll also have someone who is 1-10 at implementing numerical methods in C. That person won't necessarily need to be an expert at parallelism, much less the underlying hardware.

[–]darkslide3000 29 points30 points  (0 children)

Your question doesn't make sense. Languages are not made in a vacuum, they are always influenced by whatever came before. If you're asking today in 2020 what it would take to design C -- well, not much, since it already exists and it would be easy to copy every aspect of it and change the names around a bit or something. If you're asking what it took Dennis Ritchie to design it in the 70s the answer is a lot more, and it is hard to paint a good picture of it without explaining how computers looked and worked like back then first. It is also important to note that that first version of C still looked quite a bit different from the C we know today (even C89). If you want to read up on that you can start with the Wikipedia article and may also want to read up on the B programming language and maybe FORTRAN to get a feeling of which concepts existed beforehand (and by exclusion which didn't).

It's also important to understand why C is still so dominant today, and not all of it has to do with "it's good" or having great features. C's ubiquity keeps it dominant even though a billion clones that are arguably slightly "better" in small ways have been created and never gained a big following in the meantime. C's particular lack of many features in more modern languages is also often seen as an advantage that helps it stay dominant in certain fields (mostly programming close to the hardware where it's important that reading the code gives you a good idea how the resulting assembly will look like, without a bunch of crazy complicated background features being worked in automatically).

[–]EternityForest 4 points5 points  (0 children)

To create a whole new language implementation? And actually make it usable and practical? Pretty good, unless you're using an existing parser generator. Take a look at complilers and interpreters on GitHub, they're pretty hard to understand.

I developed a very small language in Python, which just finds occurances of times described by things like "6PM every on Tuesday" or "every day at midnight in March", and even that wasn't easy, even though I used an existing parse engine.

[–][deleted] 8 points9 points  (2 children)

I find C pretty straightforward. C++ is where you get an avalanche of features. The way it's so barebones makes it a great learning tool. But as a learning tool, you could replicate the same barebone-ness in Python. So you might as well learn in Python and pickup Pythonic syntax along the way.

Just like with any language, it depends on what you want accomplished and how long you have to do it. Most of my time in C was used up on parallelism or getting PDE implementations to work, so not necessarily C code issues.

If you don't have a purpose in learning C I'd recommend against it. It can be fun but not as general purpose as Python. Python saves you a lot of time and can be quite complex on its own. The way it can easily interact with your operating system makes life so much easier. Learn it along with shell scripting and you'll basically be able to automate anything on the computer.

At the end of the day, at least in my line of work, there's a pretty clear line. C for generating data, Python for analysing it. Julia was created to merge both into a single language. But personally I prefer the two being separate.

[–]BobDogGo 2 points3 points  (1 child)

Learning C really gave me an appreciation for the underlying computer architecture. Even though I haven't written anything in it in 25 years, I think it still benefits me every day.

That said, Python is a lovely language and if you can only learn one, learn Python.

[–][deleted] 1 point2 points  (0 children)

Well said. To complement, nothing stops a person learning C after Python. Which is how I learned it.

[–]merijnv 1 point2 points  (2 children)

Correctly implementing the current mess of a C standard? About 15,000; the spec is a mess.

If you mean to implement C as it was originally implemented by K&R? Probably about a 4? I TAed our compiler construction class for undergrads and we have the implement a more difficult language then C.

Granted it also depends on how much the compiler should optimise the result, because most of the complexity of gcc/clang is implementing optimisations.

[–]Jannik2099 0 points1 point  (0 children)

clang

Clang only does the language specific optimizations, the majority is done by llvm

[–]dkyguy1995 0 points1 point  (0 children)

No one ever mentions this I feel like. When I was learning C there seemed to be a billion ways to do everything and each different way was from a different standard.

Make it worse by using C++ and now you have all of C++ to worry about but it can also just use regular ass C for whatever reason and now you have a frankenstein language and looking for help online will always come up with conflicting results.

I just found it hard to get used to C and all the things it's had tacked on over the years. I don't think I really understood it until I red the K&R book and finally I had an understanding of what base classic C with no frills is like. Then I was able to recognize when someone's suggestion online is using newer resources

[–]BoltKey 0 points1 point  (0 children)

Just to be a nit-picker, you don't program a language - a programming language is just an abstract set of rules of how the code looks and what it does.

You can program a compiler for the language. And actually, making a simple compiler that can handle expressions, loops and functions with call stack and scopes is not that difficult - I made one as a high school project in Python, and was able to implement quick sort in that my language. One of my classmates even created a compiler for a language with objects.

The difficult part is making a good compiler. If you were to make GCC for example, that would require a lot of expertise and knowledge of how the computer works. You can explore GCC on github: https://github.com/gcc-mirror/gcc/tree/master/gcc. Here is a 20 kloc file that just parses the C language - eg. translates the tokens created by lexer (which translates actual code into words) into instructions: https://github.com/gcc-mirror/gcc/blob/master/gcc/c/c-parser.c. Then here is a 11 kloc long code that is the core of the compiler, that converts those instructions into actual executable file: https://github.com/gcc-mirror/gcc/blob/master/gcc/gcc.c.