Page 1 of 1

Wiki: C++ Barebones [Mistake]

Posted: Sat Jan 10, 2009 7:51 am
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

Re: Wiki: C++ Barebones [Mistake]

Posted: Sat Jan 10, 2009 1:06 pm
by Troy Martin
Done!

Re: Wiki: C++ Barebones [Mistake]

Posted: Sat Jan 10, 2009 2:33 pm
by gravity0
Troy Martin wrote:Done!
thanks! Hope I have been helpful.

Re: Wiki: C++ Barebones [Mistake]

Posted: Sun Jan 11, 2009 6:12 pm
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 ;)