Do I need 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
User avatar
Seahorse
Member
Member
Posts: 64
Joined: Sat Dec 03, 2016 3:13 am

Do I need C?

Post by Seahorse »

Besides Assembly, do I really need C in OSdev?

Can I just learn a different language for writing my code in?

I know you probably need to be able to read in C, but is there any other options, especially for a novice? I want to learn some new language I never touched before.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Do I need C?

Post by Schol-R-LEA »

The wiki's Languages page covers this subject in a reasonable amount of detail, actually. The general answer is, you will need to be able to read C to use most of the available learning resources, but for writing your own OS you should be able to use any language which meets the requirements laid out on that page (or rather, any language for which there is an implementation which meets them; this stipulation loosens those rules a bit, as it means that a subset or otherwise specialized compiler might be able usable where the standard versions would not be).

Mind you, there are others such as myself who take it even further and design their own language from the ground up specifically for their OS; see the Alta Lang archetype page, and maybe the CompilerDev site, for further information on this approach.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Do I need C?

Post by Love4Boobies »

No. You just need to figure out what your goals are and which language would be more suitable to achieve those goals. To give a couple of examples:
  • If I wanted to target a wide range of embedded platforms, I'd probably use C because it's the least terrible option. For all its misgivings, you can expect C to be available almost universally because good compilers for it are dirt cheap to implement.
  • If I wanted a highly reliable system, I would probably go for a functional language.
  • If I wanted a managed system, I would probably pick a safe language (Java and C# are the more popular options but there are alternatives).
  • If I wanted the system to to port existing software, I'd pick something that did not interfere with those goals.
  • If I had certain goals that are not reasonably met by existing languages, I would design my own.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: Do I need C?

Post by DixiumOS »

You don't. However, i recommend using C or other language that's not Assembly.

Assembly can be very hard, while C has a easier syntax, along with many more functions.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Do I need C?

Post by Love4Boobies »

No, assembly is actually a much simpler language than C is as far as both syntax and semantics are concerned. Similarly, C is simpler than C++ or Java are. The point is that designers will sometimes move the complexities of software inside the language so that the development process becomes simpler (i.e., you have a complex language that does complex things on your behalf).

To make an analogy, think of a printing press. You could write a book by hand. In principle, that process is quite simple, just like assembly language. In practice, it's much faster to use a complex piece of machinery (the equivalent of what we vaguely call "higher-level" languages) that will produce the book for you. The resulting book will come out faster, is almost guaranteed to have less errors. As an added bonus, you can use the same printing press for many other books as well.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
TheDev100
Member
Member
Posts: 27
Joined: Wed Jan 11, 2017 3:29 pm

Re: Do I need C?

Post by TheDev100 »

Nope, you don't need C.

Assembly is very good. It is more faster and lightweight. However, it won't support many architectures. There are many operating systems 100% fully written in Assembly like KolbriOS and MenuetOS.

If you are beginning Assembly, I suggest you learn MS-DOS debug assembly first from YouTube. There are also many references on Wikipedia. Search assembly fun or assembly tutorial kupala. This is how I learn.

Learn Intel syntax so it can run on i386 and x86 blah blah blah. It's quite popular. Use Intel's syntax.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Do I need C?

Post by dozniak »

I hope I don't hit this forum's internal limit on ignore list, it's filling up so fast.
Learn to read.
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Do I need C?

Post by glauxosdever »

Hi,

TheDev100 wrote:Assembly is very good. It is more faster and lightweight. However, it won't support many architectures.
Each architecture has its own assembly language. So, while it's true to say "A specific assembly language supports only one architecture", it's totally wrong to say "Assembly language supports only one architecture".
TheDev100 wrote:There are many operating systems 100% fully written in Assembly like KolbriOS and MenuetOS.
I must admit KolibriOS is impressive as an operating system, however it's hard for a team to write maintainable assembly code while keeping it optimised too.
TheDev100 wrote:If you are beginning Assembly, I suggest you learn MS-DOS debug assembly first from YouTube. There are also many references on Wikipedia. Search assembly fun or assembly tutorial kupala. This is how I learn.
Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
TheDev100 wrote:Learn Intel syntax so it can run on i386 and x86 blah blah blah. It's quite popular. Use Intel's syntax.
This is debatable. While I agree with you, you will find so much opposition from other people that we rather don't discuss it here.


Regards,
glauxosdever
User avatar
crunch
Member
Member
Posts: 81
Joined: Wed Aug 31, 2016 9:53 pm
Libera.chat IRC: crunch
Location: San Diego, CA

Re: Do I need C?

Post by crunch »

dozniak wrote:I hope I don't hit this forum's internal limit on ignore list, it's filling up so fast.
It's like going to the gym in January. You have all these new year's resolutioners coming in and doing exercises that are made up/should never be done and just taking up space and equipment. Luckily, the ones that weren't serious end up giving up after a month and everything goes back to normal. The ones who are serious ask questions, watch, and make an effort. And they're welcomed with open arms.

Lets hope we can say the same here.
User avatar
Seahorse
Member
Member
Posts: 64
Joined: Sat Dec 03, 2016 3:13 am

Re: Do I need C?

Post by Seahorse »

Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.
glauxosdever
Member
Member
Posts: 501
Joined: Wed Jun 17, 2015 9:40 am
Libera.chat IRC: glauxosdever
Location: Athens, Greece

Re: Do I need C?

Post by glauxosdever »

Hi,

Mark12 wrote:
Bad advice. MS-DOS assembly is by 25 years oudated (let's be optimist!) and it doesn't really teach you anything useful nowadays (even if you are writing a bootloader for BIOS, you can't use interrupt 0x21 that is present in most of assembly code for MS-DOS, so it's useless).
Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.
I didn't know I'm running my software on top of a DOS emulator...

Seriously now, do you think that learning a 35-years old technology that got obsolete 25-years ago is going to do any good to the learner?


Regards,
glauxosdever
User avatar
matt11235
Member
Member
Posts: 286
Joined: Tue Aug 02, 2016 1:52 pm
Location: East Riding of Yorkshire, UK

Re: Do I need C?

Post by matt11235 »

Mark12 wrote:Why should it matter?
His point was that MS-DOS is old cruft and can't really be applied to anything modern.
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Do I need C?

Post by Kevin »

Mark12 wrote:Would you recommend something else? Why should it matter? There is still DOS emulators people use everyday.
DOS runs in Real Mode. If you want to learn how to program assembly in Real Mode, it can be a useful start. However, you can't write a modern OS (or any modern software) with that.
Developer of tyndur - community OS of Lowlevel (German)
Post Reply