How would I start learning C for OS Development?
Posted: Thu Jan 19, 2017 3:54 pm
Hey... How would I learn C for my operating system? I know quite a lot of functions. How would I learn to use it?
The Place to Start for Operating System Developers
http://f.osdev.org/
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language.
1) This is by far the most comprehensive C Programming course you'll find here, or anywhere else.
2) This C Programming tutorial Series starts from the very basics and covers advanced concepts as we progress. This course breaks even the most complex applications down into simplistic steps.
3) It is aimed at complete beginners, and assumes that you have no programming experience whatsoever.
4) This C Programming tutorial Series uses Visual training method, offering users increased retention and accelerated learning.
Every programmer should and must have learnt C whether it is a Java or C# expert, Because all these languages are derived from C. In this tutorial you will learn all the basic concept of C programming language. Every section in this tutorial is downloadable for offline learning. Topics will be added additional to the tutorial every week or the other which cover more topics and with advanced topics.
This is we will Learn Data Types, Arithmetic, If, Switch, Ternary Operator, Arrays, For Loop, While Loop, Do While Loop, User Input, Strings, Functions, Recursion, File I/O, Exceptions, Pointers, Reference Operator , memory management, pre-processorsand more.
c tutorial for beginners. C programming tutorials for beginners.
WaterOS wrote:Hey... How would I learn C for my operating system? I know quite a lot of functions. How would I learn to use it?
Code: Select all
<rant_mode>
Code: Select all
</rant_mode>
I strongly discourage using tutorials to learn C. It's not a particularly friendly language that forgives its misuse and abuse by those who have a very incomplete and/or distorted view of what C really is. Nearly all C tutorials are incomplete, inaccurate or outright wrong. There have been plenty of books on C of the same poor quality and I have had a chance to pick up don't's instead of picking up do's from them. I then had to unlearn the bad things and learn the language the right way, paying attention to the most problematic aspects of the language, including undefined behavior, implementation-defined behavior and unspecified behavior. Those behaviors are bound to bite when writing things like operating systems. Tutorials will deceptively show the ease/simplicity of the language in simple programs. But there's a lot they won't tell. Because either the tutorial authors themselves don't quite know enough or because they just don't have the time or energy to essentially duplicate the knowledge contained in approx. 600 pages of the language standard (we can probably halve that number because not everyone is going to use every bit of the language library or write a C compiler, but that would still be a lot).dchapiesky wrote:Here ya go... good luck.
4.5 hour tutorial
https://youtu.be/-CpG3oATGIs
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language.
1) This is by far the most comprehensive C Programming course you'll find here, or anywhere else.
2) This C Programming tutorial Series starts from the very basics and covers advanced concepts as we progress. This course breaks even the most complex applications down into simplistic steps.
3) It is aimed at complete beginners, and assumes that you have no programming experience whatsoever.
4) This C Programming tutorial Series uses Visual training method, offering users increased retention and accelerated learning.
Every programmer should and must have learnt C whether it is a Java or C# expert, Because all these languages are derived from C. In this tutorial you will learn all the basic concept of C programming language. Every section in this tutorial is downloadable for offline learning. Topics will be added additional to the tutorial every week or the other which cover more topics and with advanced topics.
This is we will Learn Data Types, Arithmetic, If, Switch, Ternary Operator, Arrays, For Loop, While Loop, Do While Loop, User Input, Strings, Functions, Recursion, File I/O, Exceptions, Pointers, Reference Operator , memory management, pre-processorsand more.
c tutorial for beginners. C programming tutorials for beginners.
It is quite friendly - in that it does not limit you in how you express yourself... unlike say Java (the language that binds your hands in wool mittens and wraps you up in a carpet to protect you.) The WHOLE POINT of using C in the context of an OS is that it LETS YOU DO ANYTHING.... And needing forgiveness from a language is stupid - I WANT to poke a byte at address 0x100 (to use BASIC nomenclature) --- I WANT to see what happens when I rolls over 2000 bytes beyond 0xb8000 - just to see.. WHY cause I got's ta' learn to debug sometime... why not now?alexfru wrote:It's not a particularly friendly language that forgives its misuse and abuse by those who have a very incomplete and/or distorted view of what C really is.
You are completely right. And there is a library full of thesis papers on trying make correct programs. There are hundreds of solvers, boolean expression evaluators, and design by contract.... none of which work unless you understand why they are telling you what they tell you... thus trial, error, gdb, and freakin stack trace.alexfru wrote:The fact that a C program compiles is nowhere a guarantee that it's correct
Moot. Moooooooot. Does not enter into the discussion. Who CARES? Trying to design for the future of compilers controlled by those you do not pay is ludicrous. In C the variable name "new" used to be used like gangbusters until some jackass came along and made it a keyword in C++. "auto" used to mean one thing and now it doesn't. Things evolve, if your program is important enough you go with the flow. If your program is an OS you use gcc 4.3 for 10 or so years before upgrading to 4.6alexfru wrote:The fact that a C program appears to work as expected is nowhere a guarantee that it will continue to do so when moved to another computer or another compiler or a newer version of the same compiler.
luxury.MichaelFarthing wrote:And these youngsters learning C should be CANED if they make mistakes: it'll teach them not to do it again.
That's what happened in my day and it never did me any harm!!!
[sorry - couldn't resist it]
Except, it must be done by the rules of the language, or you can get screwed.dchapiesky wrote:[C] is quite friendly - in that it does not limit you in how you express yourself... unlike say Java (the language that binds your hands in wool mittens and wraps you up in a carpet to protect you.) The WHOLE POINT of using C in the context of an OS is that it LETS YOU DO ANYTHING....
Except, it may be thousands of credit card numbers and millions of dollars too late.dchapiesky wrote: However, in terms of the beginner, there will never be a correct program. In terms of the amateur, there will never be a correct program. And in terms of the professional - nada. Why? Cause there's always going to be a patch.
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).dchapiesky wrote:Moot. Moooooooot. Does not enter into the discussion. Who CARES? Trying to design for the future of compilers controlled by those you do not pay is ludicrous. In C the variable name "new" used to be used like gangbusters until some jackass came along and made it a keyword in C++. "auto" used to mean one thing and now it doesn't. Things evolve, if your program is important enough you go with the flow. If your program is an OS you use gcc 4.3 for 10 or so years before upgrading to 4.6alexfru wrote:The fact that a C program appears to work as expected is nowhere a guarantee that it will continue to do so when moved to another computer or another compiler or a newer version of the same compiler.
We do, indeed. Please concern yourself with this latest standard, as it makes C much more pleasant to use.alexfru wrote:(do we call it C11?), but you don't need to concern yourself with it now. Most of the things are in C89 and C99.
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. This task amounts to turning off updates and literally building my entire toolchain from the same tarballs. It is infuriating but it has to be done.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).
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.dchapiesky wrote: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.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'm afraid we don't have an agreement here.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.
This doesn't make any sense. C language does not have any functions "to know", except the actual syntax for declaring and defining functions.WaterOS wrote: I know many functions already.
Everything has functions. Java has system.out.printlndozniak wrote:This doesn't make any sense. C language does not have any functions "to know", except the actual syntax for declaring and defining functions.WaterOS wrote: I know many functions already.
Which functions do you know then?