OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 10:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: What are some proper books for learning C?
PostPosted: Sat Oct 31, 2015 7:02 pm 
Offline
Member
Member

Joined: Tue Sep 23, 2014 6:12 pm
Posts: 144
I have a little bit of theoretical programming knowledge already, but what are some proper book suggestions for those starting to program C? Is ANSI K&R a good idea or not? I don't think it will matter, but I asked for an opinion.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Sat Oct 31, 2015 10:38 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
K&R 2nd ed.

C: A Reference Manual 5th ed. by Harbison & Steele Jr.

C99 + TC1 + TC2 + TC3, WG14 N1256:
http://www.open-std.org/jtc1/sc22/wg14/ ... /n1256.pdf

Rationale for C99:
http://www.open-std.org/jtc1/sc22/wg14/ ... eV5.10.pdf

The New C Standard: An Economic and Cultural Commentary:
http://www.knosof.co.uk/cbook/cbook.html


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Sun Nov 01, 2015 4:45 am 
Offline
Member
Member

Joined: Wed Jun 03, 2015 5:03 am
Posts: 397
I think the toolchains are also very important. I have no deep expertise in C, so I hope for available toolchains review and recommendations. And may be some OS specifics like ELF or Portable Executable, DLLs vs SOs, POSIX vs Windows API and so on. But may be it's not the osdev.org where such information should be, then some links are very appreciated.

_________________
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability :)


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Sun Nov 01, 2015 6:58 pm 
Offline
Member
Member

Joined: Tue Sep 23, 2014 6:12 pm
Posts: 144
Is C absolutely necessary for a aspiring OsDever? I do think it's interesting to learn, don't get me wrong.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Sun Nov 01, 2015 7:23 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
SeanMc wrote:
Is C absolutely necessary for a aspiring OsDever? I do think it's interesting to learn, don't get me wrong.

No, you can write an OS in assembly language.
Is assembly absolutely necessary for an aspiring OsDever?
No, you can write an OS in machine code.
Is machine code absolutely necessary for an aspiring OsDever?
No, you can hire someone.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Sun Nov 01, 2015 8:46 pm 
Offline
Member
Member

Joined: Tue Sep 23, 2014 6:12 pm
Posts: 144
alexfru wrote:
SeanMc wrote:
Is C absolutely necessary for a aspiring OsDever? I do think it's interesting to learn, don't get me wrong.

No, you can write an OS in assembly language.
Is assembly absolutely necessary for an aspiring OsDever?
No, you can write an OS in machine code.
Is machine code absolutely necessary for an aspiring OsDever?
No, you can hire someone.

Well, I guess that answer speaks for itself.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Mon Nov 02, 2015 7:59 am 
Offline
Member
Member

Joined: Wed Jun 03, 2015 5:03 am
Posts: 397
SeanMc wrote:
Is C absolutely necessary for a aspiring OsDever? I do think it's interesting to learn, don't get me wrong.

Well, then you can learn something else. But your starting point was about learning C. Strange transition.

_________________
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability :)


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Mon Nov 02, 2015 8:52 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 16, 2014 5:59 am
Posts: 543
Location: Shahpur, Layyah, Pakistan
SeanMc wrote:
Is C absolutely necessary for a aspiring OsDever? I do think it's interesting to learn, don't get me wrong.

I've written an OS, which is self-hosting, in an assembly language. And believe me or not, I know nothing about C. I can (barely) understand the code written in C, though. I've tried several times to learn it but it's too hard and probably useless. Just assembly is enough for me.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Mon Nov 02, 2015 1:22 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
muazzam wrote:
I've written an OS, which is self-hosting, in an assembly language. And believe me or not, I know nothing about C. I can (barely) understand the code written in C, though. I've tried several times to learn it but it's too hard...

I believe you. Been there.

muazzam wrote:
I've tried several times to learn it but it's too hard and probably useless. Just assembly is enough for me.

I don't think I could find a job in low-level areas (OS, embedded, etc), where I could get away with just assembly language. (NASA is looking for living dinosaurs who can program in assembly, FORTRAN and COBOL.) I've been cashing my C, C++ and assembly knowledge and skills for the past 15 years or so.

Nevertheless, I too had a tough transition to C. I learned my first programming languages in this order: ZX Spectrum BASIC, Z80 assembly, Borland/Turbo Pascal, i8051 assembly, x86 assembly, C. Like I said earlier, C is awkward for historical reasons. This is of little help to a beginner, of course, but C is not awkward for the sake of being awkward or keeping noobs out. The titles and the links shown above should be sufficient for learning proper C. But you also need to write lots of code to internalize the language. If you have a friend, who knows C well (preferably, very well, because it's not uncommon to learn bad habits from someone knowing it poorly or having major understanding gaps when it comes to things like undefined behavior), then their help can be tremendous. And, IMO, you don't need a lot of help. You probably just need some help with navigating through a few bad places. Otherwise the language is rather simple.


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Tue Nov 03, 2015 11:49 am 
Offline
Member
Member

Joined: Sun Feb 01, 2009 6:11 am
Posts: 1070
Location: Germany
SeanMc wrote:
Is C absolutely necessary for a aspiring OsDever?

Passive knowledge is pretty much a must because otherwise you won't understand most code examples. But you can always write your own code in a different language - not only assembly, which has already been mentioned, but also other high level languages. That said, I did write some kernel code in Pascal and while it's definitely workable, it's not quite as smooth as with C.

_________________
Developer of tyndur - community OS of Lowlevel (German)


Top
 Profile  
 
 Post subject: Re: What are some proper books for learning C?
PostPosted: Thu Nov 05, 2015 8:01 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
The wiki does a fair job of covering the possibilities and pitfalls of using a language other than C or assembly for OS dev. See the Languages for OS Development and Developer Archetypes: Alta Lang entries for advice on this subject and critiques to this approach.

You can also look at the Bare Bones pages for Ada, D, Pascal, and FreeBasic. Someone probably should write up BB pages for Rust, Go, and C# as well, given the interest in them, but that's up to contributors familiar with them.

My own approach is rather unusual, in that I am writing my own (unconventional) assembler and designing a new language that will target it, with OS dev being the key but not sole purpose for them. My OS will be in layers, and much of the kernel for the OS proper will be in assembly.

_________________
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 139 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group