[fpc-devel] MemSize argument validity

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Feb 17 10:40:04 CET 2010


On 16 Feb 2010, at 19:11, Nikolai Zhubr wrote:

> I've just discovered that passing an invalid pointer to MemSize()  
> results in a bogus value returned and no error generally reported.  
> Is this intentional?

It's just as intentional as dereferencing an invalid pointer can  
result in a segmentation fault, that freemem'ing an invalid pointer  
can corrupt the heap, etc. It's how manual memory management works:  
the programmer is responsible for not making any errors with pointers.


Jonas



More information about the fpc-devel mailing list