- 302comments
- 86comments
- 110comments
- 189comments
- 33comments
- 34comments
- 337comments
- 497comments
- 128comments
- 20comments
- 150comments
- 306comments
- 387comments
- 5comments
- 37comments
- 28comments
- 116comments
- 585comments
- 12comments
- 19comments
- 18comments
- 16comments
- 20comments
- 121comments
- 42comments
- 6comments
- 39comments
- —discuss
- 11comments
- 4comments
What type of projects are you trying to build? Are you working on embedded technology or are you building web apps? The type of environment you work in will help decide. C is still a relevant and powerful language, but there are more modern alternatives in the same space like Rust.
Maybe if you want to write a kernel driver or a file system.
You can't go wrong with it. But for what purpose?
If you want to work, for example, in embedded systems it's a must
imho: always
especially if you are in to hardware, embedded, hpc, ... usecases.
The GNU/Linux kernel, FreeBSD kernel, Windows kernel, MacOS kernel, Python, Ruby, Perl, PHP, NodeJS, and NumPy are all written in C. If you want to review and contribute code, you'd need to learn C.
There are a number of coding guidelines e.g. for safety-critical systems where bounded running time and resource consumption are essential. These coding guidelines and standards are basically only available for C, C++, and Ada. https://github.com/stanislaw/awesome-safety-critical/blob/ma...
Even though modern languages have garbage-collection that runs whenever it feels like it, It's helpful to learn about memory management in C (or C++). You'll appreciate object destructor methods that free memory and sockets and file handles that much more. Reference cycles in object graphs are easier to handle with modern C++ than with C. Are there RAII (Resource Acquisition is Initialization) "smart pointers" that track reference counts in C?
Without OO namespacing, in C, function names are often prefixed with namespaces. How many ways could a struct be initialized? When can I free that memory?
When strace prints a syscall, what is that?
Is it necessary to learn C? Somebody needs to maintain and improve the C-based foundation for most of our OSs and very many of our fancy scripting languages. C can be very unforgiving: it's really easy to do it wrong, and there's a lot to keep in mind at once: the cognitive burden is higher with C (and then still with ASM and WebASM) than with an interpreted (or compiled) duck-typed 3GL scripting language with first-class functions.
What's a good progression that includes syntax, finding and reading the libc docs, Make/CMake/Autotools, secure recommended compiler flags for GCC (CPPFLAGS, CFLAGS, LDFLAGS) and LLVM Clang?
C: https://learnxinyminutes.com/docs/c/
C++: https://learnxinyminutes.com/docs/c++/
Links to the docs for Libc and other tools: https://westurner.github.io/tools/#libc
xeus-cling is a Jupyter kernel for C++ (and most of C) that works with nbgrader. https://github.com/QuantStack/xeus-cling
What's a better unit-testing library for C/C++ than gtest? https://github.com/google/googletest/
Amazing comment, thank you for your detailed input and the awesome resources. I want to get into C because I like network and system programming but lack the underlying knowledge and experience. These links will help me start on that new path. Very much appreciated sir :)
For network programming, you might consider asynchronous programming with coroutines. C++20 has them and they're already supported in LLVM. For C, there are a number of implementations of coroutines: https://en.wikipedia.org/wiki/Coroutine#Implementations_for_...
CPython's asyncio implementation (originally codenamed 'tulip') is written in C and IMHO much easier to use than callbacks like Twisted and JS before Promises and the inclusion of tulip-like async/await keywords in ECMAscript. Uvloop - based on libuv, like Node - is apparently the fastest asyncio event loop. CPython Asyncio C module source: https://github.com/python/cpython/blob/master/Modules/_async... Asyncio docs: https://docs.python.org/3/library/asyncio.html
(When things like file or network I/O are I/O bound, the program can yield to allow other asynchronous coroutines ('async') to run on that core. With network programming, we're typically waiting for things to send or reply.)
Return-oriented-programming > Return-into-library technique is an interesting read regarding system programming :) https://en.wikipedia.org/wiki/Return-oriented_programming#Re...
Only matters if you want to work in embedded devices/IoT, operating systems, any other type of systems development or high-performance development, and some segments of game development or games middleware.
Yes. Many current hot languages are based on the C's structure plus there are millions of lines of C code that need maintenance. It's worth learning now and it will be worth learning 10 years from now.
I say yes because, as others have pointed out, C is at the base of nearly everything. If not C then you should learn some systems level language, be it C, D, rust or whatever. If you want to know how modern computing actually works then that's the way to do it.
You'll learn lessons that will teach you how to avoid common pitfall mistakes in higher level languages. And you'll be able to interop with C/C++ libraries which can be quite useful. And your code will run faster than most other languages can achieve. There are lots of reasons to learn C even today.
Most certainly. I do suggest C++ over C though, for a higher paying job.
yes