|
From: <and...@su...> - 2003-09-15 19:56:04
|
GREAT... Thank you all!
One last question: inline functions provide more speed. No
doubt about that. But,
Are inline functions allowed in C or only in C++?
Regards
Andre Barros
ps1: regarding the prototype stuff, probably I will make a test with
20 dummy functions been called by the main function and compare
to its "mirror" case (without prototypes).
ps2: very interesting the answer to the main stuff :-)
-----Mensagem original-----
De: Per Westermark [mailto:pw...@ia...]
Enviada em: segunda-feira, 15 de setembro de 2003 14:24
Para: Ricardo_López-Ruiz
Cc: André Macário Barros; Dev-C
Assunto: Re: ENC: [Dev-C++] Two Questions
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ópez-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
>
|