delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/22/03:05:49

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: <Pine DOT SUN DOT 3 DOT 91 DOT 970819161648 DOT 21250R-100000 AT is> <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


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019