|
From: Per W. <pw...@ia...> - 2003-09-15 17:24:21
|
1) Normally, it doesn't matter if the compiler sees just a function prototype or if it sees the complete implementation before you call a function. However, some compilers have a compiler switch that allows the compiler to itself select functions for inlining. Obviously, with only a function prototype it can't inline the function. However, if the code is in the same source file, but after the call, the compiler is probably smart enough to find it anyway, since most compilers doesn't generate any code immediately for release build, but only builds parse trees in memory before performing the different optimization steps. 2) You can compile a program without a main() but you can't link the program. The startup code hidden somewhere inside the run-time-library code does contain a call to a main function. Either you have to supply it, or it must be available in a object or library file included in the linking. For Windows, one of the Windows libraries contains a main(). /Per W On Mon, 15 Sep 2003, Ricardo_L=F3pez-Ruiz wrote: > question 1): > Try to build a program with the 2 possibilities you are proposing > and keep the running time in both cases... after that, you could tell us > the result... > as you say it seems that there wont be any difference, that is, > the final binary code is the same in both cases. > > question 2): the main function is not needed to run, if not essentially > to compile the code...without the main function the compiler doesnot know > where the nucleus of the program is, then the compiler can not compile... > it is the 'door' toward the code...without 'door' you can not go into... > > > hope it helps you, > Ricardo. > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |