OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 9:02 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Cygwin : error: no 8-bit type
PostPosted: Sat Jul 17, 2010 7:08 pm 
Offline
User avatar

Joined: Thu Jul 15, 2010 3:00 am
Posts: 10
Hi guys!
I've found a book in my school's library teaching the C language , so I've started reading and discovered many new things .To practice , I've took a look at the C bare bones tuto , and wrote a kernel that does 2 things
Clear the screen , Print a hello message in protected mode
it's just to practice . it's loaded by grub .
so i was thinking if someone of you may take a look at my source code and tell me some thins about my programming/writing manner , some advices ....
so the source and the an boot image are included in the attachment .
Thanks guys


Attachments:
ngos.rar [56.77 KiB]
Downloaded 75 times

_________________
The WORLD is RELATIVE .
http://en.wikipedia.org/wiki/Theory_of_relativity
Top
 Profile  
 
 Post subject: Re: Cygwin : error: no 8-bit type
PostPosted: Sun Jul 18, 2010 12:40 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
  • In C/C++ it is common practice to start function names with lower case (myFunction()). Only structs and - in C++ - classes are started in uppercase (struct MyStruct, MyClass).
  • Very nice that you documented your functions with source comments!
  • Use a .h file to declare the functions, and a .c file to define them. Place the documentation for each function right before its declaration instead of bundling the docs at the top of the file.
  • Avoid variables that are initialized to some constant value and then only used once. The compiler probably optimizes away the actual creation of the variable on the stack, but it introduces a variable name that's completely irrelevant (msgOEM, udlOEM).
  • Your indenting is good. But you used three-space indent, four-space indent, and tab indent all mixed together. Set your editing environment to using one indenting style consistently. There's some holy war around the subject, but in the end four-space indent and tab-indent are the only two suitable alternatives, and I strongly favor the four-space indent.
  • At various points in the source, you use "magic numbers". (Any numerical constant not -1, 0, or 1.) It's good practice to declare them as int const (or preprocessor token) at one central place, including a quick one-line comment as to what they mean. Especially when those numbers are used in more than one place (e.g. VIDEO_BASE instead of 0xb8000).
  • If your orthography lets something to be desired, don't hesitate to use a spell checker on something like Readme.txt.

I've seen much, much worse C code. You didn't do half bad.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: Cygwin : error: no 8-bit type
PostPosted: Sun Jul 18, 2010 1:38 am 
Offline
User avatar

Joined: Thu Jul 15, 2010 3:00 am
Posts: 10
Ok Thanks solar
i'll keep that in mind

_________________
The WORLD is RELATIVE .
http://en.wikipedia.org/wiki/Theory_of_relativity


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 15 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