Mail Archives: djgpp/1997/08/22/03:05:49
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 -