dchapiesky wrote:
alexfru wrote:
In my understanding the flow is such that the Linux kernel compiles with a bunch of compiler options making gcc behave as in good old days when people were able to ignore the C standard and get away with it because compilers (and computers they ran on) weren't powerful enough. Most of undefined behavior was defined in 1989 and hasn't changed much since, so bad code not working anymore shouldn't come as a surprise, and yet it does. Or people force the compiler to be dumb (disable optimizations) and mute (disable or ignore warnings).
I can see you are probably a purist and I can identify with that. In my work I have to be able to deterministically reproduce exactly the same code in exactly the same manner.
My first full time job had projects that needed to compile with different compilers for different architectures and yield identical results (save performance differences). In my next full time job security and reliability of several projects were very important. So, this demanded writing solid and portable code and testing and reviewing code for language-specific defects.
But before we get there, we have to start somewhere. Naturally, nobody's born with knowledge of C.
I started to learn C in the late 90's. Many got internet access for the first time in Russia in 96 or so. For me it was very painful to download an application of interest that wouldn't compile or would but wouldn't work and I had to go through a lot of trouble to make them compile and work without knowing well the language or what someone else's code was supposed to do and how. I didn't have the right books nor a copy of the language standard. I had to reconstruct the language model as described in the standard by trial and error, from bits found in newsgroups and other places online. This is the wrong way to do it. It's inefficient and there still remain gaps after the exercise. How do you close them? You learn the language the right way. You may do it on the job. But you may not always get the job you want if the potential employer sees gaps in your knowledge in the areas deemed crucial.
Further, unlearning/relearning is problematic by itself. So, why not do things the right way when everything you need to do it is available (books, standards, advice, etc)?
dchapiesky wrote:
But I must disagree with you, if only because of the context of this thread - a beginner wanted to know how to use C - not java, not tcl, not lisp, not smalltalk... C.
The issues you are raising, while valid, have no place in a discussion about learning C.
I'm afraid we don't have an agreement here.
Edit: I should remind you that the context is "How would I learn C for my operating system?". It's gonna be especially tough to make bad code work without crashing, hanging or otherwise misbehaving with minimal debugging facilities.