Show quoted text 28 lines
-----Message d'origine-----
De : [mailto:fpc-devel-
De la part de Gennady Agranov
Envoyé : samedi 10 janvier 2015 05:19
À : FPC developers' list
Objet : [fpc-devel] Question about runtime error 219
Hi All,
What exactly -CR (Verify object method call validity) code generation
is
checking and how tested is it?
For debugging I prefer to enable all possibles checks - range,
overflow, ...
But i can not use -CR:
1. I passed some "var array of array" parameter - error 219 - changed
to
var array - works...
2. I use generics and 2.7.1 and when I am calling some method that is
implemented in grandfather class - runtime error 219 :(
But, If I do not set -CR - everything works just fine...
Any internal scoop about -CR - please?
The -CR option add, before any virtual method call, a call to a special function fpc_check_object_ext
to check that the real class of the class variable which is used is indeed a child of the explicit class type specification of this method.
Example
var
c : class;
begin
derivedclass(c).method1;
the call to fpc_check_object_ext will be done with the true class of c (as given by the address of the vitual method table) to the virtual method table of derived type
This is more or less equivalent to
assert that c is indeed a child type of derivedclass.
It is possible that this option -CR will
generate a RTE 219 in perfectly working code,
a possible case is when two different derived classes implement "compatible" child methods, that end up at the same position in the virtual method table, but without a common virtual definition for the common ancestor.
Pierre Muller
assert