Question about developing a kernel in C/C++

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
SNeKKe

Question about developing a kernel in C/C++

Post by SNeKKe »

hi everybody,

i'm currently learning C as you might have already read in my previous topics.
Now, I was looking at a kernel that was using the printf...
In my book, the line
#include <iostream.h>
and then cout << "...";

can I use this include-things instead of the printf???
And are there any things I must watch out for?

Sorry for my bad English :-[

Thanks a lot!
jrfritz

Re:Question about developing a kernel in C/C++

Post by jrfritz »

In making a OS you need your own printf...you can't use the ones pre-made...you have to use someone elses like mine or make your own...

cout is hard to make...so I made a printf...
richie

Re:Question about developing a kernel in C/C++

Post by richie »

if you print something in a normal programm, like you learn in your C/C++-book, you always calls functions. Although cout doesn't look like a function it actual is a function. Cout is a special kind of function. This type of functions are called operator functions. Operator functions are a new feature of C++. Before C++ there was c. To print something in c you use another function called printf. So if you want a normal programm to print something you have two functions to do that: cout and printf. Both of these functions call system functions of the operating system. If you want to develop your own operating system you cannot use printf or cout because they want to call system function and these system functions are not present. So you have to write your own functions for printing on the screen.
But I advice you to learn C/C++ and asm before starting your own operating system.
Mr_Spam

Re:Question about developing a kernel in C/C++

Post by Mr_Spam »

cout and cin are macros of other functions.
Willy

Re:Question about developing a kernel in C/C++

Post by Willy »

I also thought that it would be hard to make cout, but really it wasn't. Of course, for now it only prints char messages :P But i'm learning ... ;D
Post Reply