19.01.2010 12:31, Jonas Maebe:
Does FPC know how to find this places on compile time and at least
issue a
warning about it ?
No, it doesn't. In principle, the compiler can't even be sure that you
haven't replaced the default memory manager with e.g. some
garbage-collector-style memory manager similar to Boehm GC, in which
case such warnings would be wrong.
May I put it a bit other way?
Would it be possible/feasable to introduce some (optional) restrictions
and/or extensions to pointer-related syntax and/or pointer-related parts
of RTL so as to completely ensure safety if pointer operations?
This would probably include:
- guaranree that dynamically allocated will not be silently lost (leak)
- guaranree that dynamically allocated mem will not be disposed twice;
- guarantee that dynamically allocated mem will not be accessed beyond
the respective allocation size.
I'd guess this would require huge work and substantial modifications to
the language though. And probably, this is not possible without GC, and
I don't like GCs anyway :)
Nikolai
Jonas
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel