Page 2 of 2

oh?

Posted: Mon Oct 23, 2006 11:06 am
by Cmaranec
I am totally beginner. WHAT i must do for my OS??? Please concretely. :arrow:

Posted: Mon Oct 23, 2006 12:30 pm
by bluecode
Are you a total C++ newbie or just new to osdev?

Point is, if your a c++ newbie, than don't try to write an OS in C++. It's just to complex. If you want an std::string class, then write your own, which includes the following things:
* std::allocator template (you need to write your own new/delete/malloc/free/calloc here)
* std::char_traits template and the specialisation for char (and in case you need any of the c library functions here, you also have to write your own, e.g. strlen, strcpy, ...)
* std::basic_string template and the specialisation for char
* typedef the basic_string<char>

Yeah, pretty heavy, ain't it? So if you don't know your language _in_ _detail_ , then go and learn this first. You can not handle these two things at once. You will end up in debugging session darker than a black hole not just the normal dark than night sessions ;)

Another point is that you can not use exceptions (no try, catch, throw), RTTI (= Runtime type-information, no dynamic_cast, no pure virtual functions) and memory management (new, delete and the placement and array equivalents) until you wrote your own functions for this, which depends on the compiler...

thx

Posted: Mon Oct 23, 2006 12:35 pm
by Cmaranec
Thanx, i am newbie on osdev. In C++ i am good :D .

Posted: Mon Oct 23, 2006 3:22 pm
by Candy
bluecode wrote:If you want an std::string class, then write your own, which includes the following things:
* std::allocator template (you need to write your own new/delete/malloc/free/calloc here)
http://svn.sourceforge.net/viewvc/atlan ... iew=markup
* std::char_traits template and the specialisation for char (and in case you need any of the c library functions here, you also have to write your own, e.g. strlen, strcpy, ...)
http://svn.sourceforge.net/viewvc/atlan ... iew=markup
* std::basic_string template and the specialisation for char
* typedef the basic_string<char>
http://svn.sourceforge.net/viewvc/atlan ... iew=markup
Yeah, pretty heavy, ain't it? So if you don't know your language _in_ _detail_ , then go and learn this first. You can not handle these two things at once. You will end up in debugging session darker than a black hole not just the normal dark than night sessions ;)
Well, actually I cheated on string, it's a blank implementation. It gets stuff compiling though :).

Still, I can pretty much confirm that most of OS dev stuff is pretty hard to do, and it's very much increasingly easier when you accept other people's code. I refuse to accept anything except for a very few types of code, so there's only two files in my archive that contain code that somebody else touched. If you accept the default implementation and the license that comes with it (mostly the second for me), you can reuse the code. The extreme of course is just plain using Windows, the other extreme is not using any code that anybody else wrote. I'm going for the second, most sane people go for the first. Anybody not completely mad goes for something in between (and if you really are mad, I'd like to meet you :)).
Another point is that you can not use exceptions (no try, catch, throw), RTTI (= Runtime type-information, no dynamic_cast, no pure virtual functions) and memory management (new, delete and the placement and array equivalents) until you wrote your own functions for this, which depends on the compiler...
Yep. You can also find very small example code for this in the same svn archive as the above code. They're all still untested, as I'm busy with the kernel and bootloader first. The bootloader is ok (except for a few bits), the kernel is still active work for me (right now, except that I'm websurfing).

Posted: Tue Oct 24, 2006 2:27 pm
by Cmaranec
Wow, thanks. I find this codes in other open source projects. I didn't find anything :lol: