Wiki: C++ Barebones [Mistake]

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.
Post Reply
User avatar
gravity0
Posts: 16
Joined: Fri Jan 09, 2009 8:47 am
Location: Belluno, Italy
Contact:

Wiki: C++ Barebones [Mistake]

Post by gravity0 »

Hello guys,
while reading the wiki regarding the C++ Barebone Kernel I found an error into the code in section "main.cpp". multiboot_data, in fact it's not declared and so the code won't compile. The code should be like this:

Code: Select all

extern "C" void _main(void* mbd, unsigned int magic);

void _main( [b]void*[/b] mbd, unsigned int magic )
{
   // write your kernel here
}
Unless you define multiboot_data with a typedef obvoiusly
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Wiki: C++ Barebones [Mistake]

Post by Troy Martin »

Done!
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
gravity0
Posts: 16
Joined: Fri Jan 09, 2009 8:47 am
Location: Belluno, Italy
Contact:

Re: Wiki: C++ Barebones [Mistake]

Post by gravity0 »

Troy Martin wrote:Done!
thanks! Hope I have been helpful.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Wiki: C++ Barebones [Mistake]

Post by JamesM »

I'd prefer that to be written as:

Code: Select all

int main(struct multiboot_data *mbd, unsigned int magic)
This should compile with only a warning (because of the "struct") - as long as mbd isn't dereferenced - and it gives a visual hint to the reader that there's something special about that parameter - it's a struct, not some arbitrary point in memory.

Wiki updated. Roll back if required ;)
Post Reply