From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Function Sizes (how to in asm?) Date: 22 Aug 1997 05:41:47 GMT Organization: The National Capital FreeNet Lines: 36 Message-ID: <5tj8qr$i8t@freenet-news.carleton.ca> References: <33FA2DB2 DOT 3DC3 AT cornell DOT edu> Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet2.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Why doesn't DJ or some other guru modify GCC so that 'sizeof (func)' returns the size of a function? Presumably the compiler knows the size of the function, once it has compiled it. The obvious stipulations are that the sizeof() would only work in the same code file with the function, and after the function itself, and its use would have to force the compiler not to inline the function. Thus, you'd use something like volatile int foo; void myqueueincrementer (void); void lockmem (void); int main (void) { lockmen(); . . . install_timer (myqueueincrementer); // Might have goofed, haven't used that // bit of allegro in a while. void myqueueincrementer (void) { foo++; } . . . void lockmem (void) { __dpmi_blah_foo_blah_blah (&foo,4); __dpmi_mumble_mutter_bar (myqueueincrementer,sizeof(myqueueincrementer)); } -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh