is it possible to size a pointer's target?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
 Hi Everyone,
 
I'm interested in whether it is possible to get the size of a variable a
pointer is pointing at.
 
I have a function that accepts a char * pointer. This can either be stack or
heap memory but more typically stack where I see it.
 
It would help me tremendously if I could figure out the size of the variable
at the other end of the pointer. I can't think of a way to do this
unfortunately.
 
strlen won't work as the variable is null when passed in
sizeof(*ptr) returns 1, even though the memory is larger
 
sizeof(ptr) returns 4 (on my 32 bit machine) of course
 
Can anyone think of how to do this, or am I out of luck?
 
Thank you in advance,
Andrew



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux