Someone asked me recently how to count the size of a function in c++;
I use function size counting all the time and it has lots and lots of uses.  Is it reliable?  No way.  Is it standard c++?  No way.  But that's why you need to check it in the disassembler to make sure it worked, every time that you release a new version.  Compiler flags can mess up the ordering.
static void funcIwantToCount()
{
   // do stuff
}
static void funcToDelimitMyOtherFunc()
{
   __asm _emit 0xCC
   __asm _emit 0xCC
   __asm _emit 0xCC
   __asm _emit 0xCC
}
int getlength( void *funcaddress )
{
   int length = 0;
   for(length = 0; *((UINT32 *)(&((unsigned char *)funcaddress)[length])) != 0xCCCCCCCC; ++length);
   return length;
}
It seems to work better with static functions.  Global optimizations can kill it.
P.S. I hate people, asking why you want to do this and it's impossible, etc.  Stop asking these questions, please.  Makes you sound stupid.   Programmers are often asked to do non-standard things, because new products almost always push the limits of what's availble.  If they don't, your product is probably a rehash of what's already been done.  Boring!!!