sizeof(function) - preproposal survey

00704a-Liber nevin1 at ihlpf.ATT.COM
Tue Feb 16 13:18:30 AEST 1988


In article <11801 at brl-adm.ARPA> LINNDR%VUENGVAX.BITNET at CUNYVM.CUNY.EDU writes:
>The gist of my proposal is that the
>sizeof operator, when applied to a function name, would return the
>length of the function rather than the size of a pointer to a function.
>
>While this is a change, it is also (probably) an upward compatible extension
>that would provide a capability not currently available in C but in keeping
>with the "spirit of C" (Let's hear an AMEN, brothers and sisters!) as
>this information is generally available in the assembly code that C allows
>us to forego.

Obviously, it is NOT upward compatible, although not many functions bother to
find the size of different types of pointers.  But what happens when you need
the size of a pointer to a function??   How do you find it??

Also, I do not think it can be implemented all that easily to remain compatible
with current versions of C libraries and object code (which currently do not
necessarily keep the 'length' of the *function* around).  Also, what exactly do
you mean by the 'length' of the function.  Is it the actual code segment size,
does it include automatic vars and static data, etc.??  Suppose it is just the
code segment size; then how do I get the sizeof the data segment??  And what
exactly do you do for functions that produce in-line assembly instead of actual
function calls?

This function would be incomplete, at best.  And for that reason alone I don't
think it is worth changing.
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah



More information about the Comp.lang.c mailing list