[A83] Re: C(++) programming


[Prev][Next][Index][Thread]

[A83] Re: C(++) programming




Actually, the function main isn't any more special then progstart or 
progstart-2(depending on the calc).
What the compiler does, is it converts your program to asm, the inital part 
is probably an initisilasation code(for example if you had a class that was 
global that needed to be set up(c++ stuff))
after that it calls the function _main(most of the c/c++ functions are the 
name you gave them plus a '_' infront of them)
but before that it pushes in and pops the data you passed to the function(why 
i belive recursion isn't as good as some say it is)

in C if a varaible is declared, but no type is given, it should default to 
int, but in c++ they dropped this 'feature'

If you declare the main function as anything other then int, some compilers 
will stop on you, while others will say 'ok' and continue on.

As far as i can tell you can call the main() function just like any other 
function(though i would be carefull with this because that can be very 
dangerous)

Also there is a destruction bit of code that is called when the main function 
returns a value.




Follow-Ups: