Language of choice??

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
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Language of choice??

Post 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... :?:
User avatar
Daedalus
Member
Member
Posts: 74
Joined: Sun Oct 16, 2005 11:00 pm
Location: Australia
Contact:

Post 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.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Post 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..
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Post 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.
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

The best language out of the 3 mentioned for OS Dev, is the one you know best.
Post Reply