Here is a simple hack that can tell whether the given address represents
a stack address or a heap address. This is not portable, but variations
of it will work on many machines.
boolean fromHeap (void* p)
{
int i;
return (p > &i);
}
Although not recommended for production quality code, this could be used
in assertions during development.