[LC++]sizeof...
    ianezz at kinsale.sodalia.it 
    ianezz at kinsale.sodalia.it
       
    Tue Aug  6 00:21:05 UTC 2002
    
    
  
Palaka, Sasidhar, pigiando tasti a caso sul citofono, ha scritto:
 > Basically the idea is to increment the pointer and then subtract to give the
 > size.
Try it with an `int'... 
the difference between pointers is in bytes/sizeof(pointed type)... so
it gives back always `1'.
Of course you could try casting the pointers to some unsigned type
large enough before subtracting them, but then how do you know how
much is ``large enough''? 
Use sizeof() and live in peace.
-- 
 |   \    \  | ___|_  |_  | ianezz AT sodalia.it
 |  _ \  | \ | _|    /   /  Visita il LinuxTrent a
_|_/  _\_|  _|____|___|___| http://www.linuxtrent.it
    
    
More information about the tuxCPProgramming
mailing list