why in Keil compiler we define the main as int rather that void ?
int main (void)
rather than ....
void main (void) ,like in C51
"The ANSI standard states that main() returns an int result"
Actually, I've just checked in ISO/IEC 9899:1990 - and that's not strictly true!
It is true for a Hosted environment but, for a Freestanding environment, the specification says:
"the name and type of the function called at program startup are implementation-defined. There are otherwise no reserved external identifiers."
So C51 is fully ANSI-compliant for a Freestanding environment.
And Keil's ANSI Compliance page says,
"Compilers from Keil are conforming freestanding implementations" http://www.keil.com/product/isoansi.asp
In other words, Keil needn't even have chosen "main" as the name for the program's main function - but they did.
Again, an 8051 is far more likely to be used in a Freestanding environment than an ARM - and this would have been especially true when C51 was first developed.
And more importantly - the C51 was developed long before the current C standard.
Changing the return value of main() would have required a compilation option, since a number of users would have been unhappy if they had to modify any source lines to be able to compile newer application. Some companies have very, very, very strict policies about changing any source code lines, even to avoid a compilation warning. Such a tiny source-code change could result in a requirement to perform several months of recertification of the application.