5 ms·
As a web developer, who mostly spends time with Go and Python, is there any benefits of learning C?
by avinassh 6y ago
As a web developer, who mostly spends time with Go and Python, is there any benefits of learning C?
- bitexploder 6y agoC is a low level language that compiles down directly to assembly. It is similar to Go in this regard, but is a bit lower level. You have to manage memory yourself and pointers in C are much more dangerous. Reasons to learn C would include: absolute performance needed maybe for say a Python C extension, kernel hacking, some other project you want to contribute to uses C. I think it’s good to at least play with C and understand how memory management and pointers in C work, but I don’t think I would recommend you go out of your way to learn C or spend any significant amount of time writing it. At the end of the day it’s just another tool in the toolbox. I would recommend the book Code, by Petzold, if you want to really want to explore computers at a low level in a friendly format.
- inb4_cancelled 6y ago> language that compiles down directly to assembly Directly to machine code, not assembly.
- fractalb 6y agonitpick. I think C compiles directly to machine code. There's no intermediate step of compiling to assembly first.
- heinrichhartman 6y agoWriting correct C is REALLY hard and slow (strings, manual memory management, concurrency pitfalls). So the investment is not paying off unless you are writing highly performance critical backend services. What can pay-off is learning to read C. Node.js, Firefox, Postgres, Linux are all written in C/C++ so if you ever want to really understand what's going on or have to debug a nasty bug, then you will need to be able to find your way around these code-bases.
- scoutt 6y ago> So the investment is not paying off unless you are writing highly performance critical backend services. You took it too far. C opens the door for today's embedded, like, you know, blinking an LED with some microcontroller.
- jcelerier 6y agoMost people do that on Arduino which is as c++ as it gets, with templates, etc...
- roryrjb 6y agoAlso beyond the codebases themselves, interactions with the running code via GDB or tracing frameworks like dtrace, bpftrace, where you often reference C data structures. As well as being able to more fully understand the output of strace and other tools.
- flohofwoe 6y agoNot really, but it depends. For instance, C is pretty great for compiling simple logic into WASM modules because the size overhead is minimal compared to most higher-level languages, or even C++ with careless use of the stdlib (and the missing memory safety isn't such a critical problem because everything runs in the WASM sandbox anyway). E.g. I think the size of my WASM demos is quite reasonable for what they do: https://floooh.github.io/tiny8bit/ https://floooh.github.io/tiny8bit/ https://floooh.github.io/sokol-html5/ https://floooh.github.io/sokol-html5/ However, AssemblyScript is also a pretty good choice for this type of stuff from what I'm hearing (while for instance languages with a complex runtime like C# are not).
- 10x-dev 6y agoYour question is too vague. Are there benefits in general? Of course, every language has something to offer. Is it useful as a web developer? Only if you want to write extensions to Python in C or step away from the web developer label and learn systems programming.
- aiioquip 6y agoFor you, yes: you will better understand Python's source code, which is written in C. Poke around the source code a bit just out of curiosity after learning a bit of C and it becomes a bit interesting.
- antegamisou 6y agoIf you're interested in: -Embedded/cyber-physical systems software (firmware dev) -Driver development (applies to Win/macOS/UNIX/iOS/Android) -Contributing to the Linux kernel/OS dev in general -Contributing to many large OSS projects (Apache, ffmpeg) -Exploit/malware dev/reverse engineering -Emulator development you'd need to learn C.
- pdpi 6y agoI find that there is a lot of value in learning "how the sausage is made". Implementing your own baby version of the things you take for granted in higher-level languages is an interesting exercise — e.g. things like dynamic dispatch. These are things that are not directly useful, but help you have a better mental model of how your language of choice actually works.