In article <11************ **********@a75g 2000cwd.googleg roups.com>,
asit dhal <pe********@gma il.comwrote:
>Can any one write a code to measure the size of a function in gcc or vc
++ ?
Maybe -- but not in standard C.
You haven't really defined what is included in "the size" of
a function. If the function has uninitialized static variables,
then do you include the size of the automatic-initialized-to-zero
region used? If the function has initialized static variables,
then do you include the size of the initialization block (which
might be in a completely different code segment and might happen
to merge initializations of multiple variables from different
functions)? On architectures that are not stack-oriented, do you
include the size of the caller save area? Does "the size" of
the function include any temporary non-heap (e.g., stack) required
for it to execute?
If an optimizer detects common code between the function and
a different function, it could merge the two paths together
as long as it had some method of determining when to split apart
again (and if the code was the tail end of the code, that might
just be the "return from subroutine" code.) When code overlaps like
that, which of the functions do you count the size against?
--
All is vanity. -- Ecclesiastes