Cygwin : error: no 8-bit type

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
User avatar
TheBadBoy
Posts: 10
Joined: Thu Jul 15, 2010 3:00 am

Re: Cygwin : error: no 8-bit type

Post by TheBadBoy »

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 91 times
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Cygwin : error: no 8-bit type

Post by Solar »

  • 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.
User avatar
TheBadBoy
Posts: 10
Joined: Thu Jul 15, 2010 3:00 am

Re: Cygwin : error: no 8-bit type

Post by TheBadBoy »

Ok Thanks solar
i'll keep that in mind
Post Reply