In C, C++ and Javeq the entry point must be called main(), yes, in the PC assembley language, it can be anything.  Why?

 

 

 When execute a C or C++ or java program, the runtime system starts your program by calling its main() function first and  the main() function then calls all the other functions. In an assembly language , programs are  implemented by using symbolic representation of the numeric machine codes and other constants needed to program a particular CPU architecture. Since we are dealing directly with the CPU machine codes , there is no need to hava  a main menomic to execute a program since we are dealing with the cpu instructions directly.

 

Armando Fonseca


Page Information

  • 6 months ago [history]
  • View page source
  • You're not logged in
  • Recent comments:
    Richard Glass:think about your explaination. the assembler is a lower level yet, C++ is more restrictive. C++ is translated into the same assembler that you are writing for this class. Your comment explaination to dan is right. Armando, you somewhat expain what happens but did not give the WHY.
    armando:No Dan , is not a convention. Even the word "main" has a significance on the compiler. A program with out the main method would compile, but on run time the compiler looks for main()and if its not there, it would throw an exception.
    Dan:The entry point does not have to be main() in C and Java. It is simply convention for the convenience of programmers and linkers.
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts