This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

main function ?

why in Keil compiler we define the main as int rather that void ?

int main (void)

rather than ....

void main (void) ,like in C51

Parents
  • 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.

Reply
  • 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.

Children
No data