Page 1 of 1

Language of choice??

Posted: Sat Jul 22, 2006 10:54 pm
by DeletedAccount
I have made a 16 bit os(in c).Right now i am planning to write the
entire thing in assembly....I am always confused which language
is the best choice 1)c 2) Asm 3)C++.......?Please advise... :?:

Posted: Sat Jul 22, 2006 11:49 pm
by Daedalus
Both C and Assembly.

C can do a lot of things, but not everything.

If you're not writing your own bootloader, you still will need to write some assembly code (usually some startup stuff and for setting up IDT/GDT and protected mode.)

C is generally whats used for the rest, due to it's portability. Assembly is NOT portable, since most architectures have their own different syntax/registers/memory/IO/methods of doing everything. Add to that the fact that theres (at least) 2 wholly different syntaxes for assembly (AT&T and Intel) and you complicate assembly even more.

In my opinion, C should be used wherever possible to maintain portability.

Of course, you dont have to touch C at all. A lot of OS' have been coded in straight assembly.


C++ is used occasionally, but I personally don't like it for OS programming.
I figure C++ should be used for applications, it's too high level for OS programming.

Posted: Sun Jul 23, 2006 12:58 am
by DeletedAccount
It's quite true that assembly part cannot be ignored...but some
fellows advocate that an object oriented kernel(ie done in C++)
can be maintained more easily....But i simply love asm(but not
very fluent).But pretty fluent in C/C++ stating learning C++
wen i was 13 yrs old..

Posted: Sun Jul 23, 2006 1:58 am
by Legend
When using C++ you'll need to write some runtime support for C++ in C. That is of course not an argument for C++. ;)

However - yes, a C++ should really be more maintainable then a C Kernel once it gets big. And duplicating OO stuff in C is ugly most of the time.

Posted: Sun Jul 23, 2006 4:36 am
by Dex
The best language out of the 3 mentioned for OS Dev, is the one you know best.