Mail Archives: djgpp/1998/02/05/07:02:44
On Thu, 5 Feb 1998, David Shirley wrote:
> void func(unsigned char *tmp)
> {
> // BLAH BLAH
> }
>
> How do i find how many bytes tmp is taking up in memory:
In general, you can't. If you need to know the size of a function,
you will need to write it in assembly. There's no C facility that you
can trust to get this functionality.
There is a hack you can use whereby you define two dummy functions,
before and after the one whose size you need to know, and then
subtract the addresses to compute the size. But that is not
guaranteed to work, although it does in GCC 2.7.2.1.
- Raw text -