On 29 May 2010, at 13:22, Tomas Hajny wrote: > I believe the same is the case with FPC and _objects_ (not classes) and > FPC is thus compatible here. The text above (mentioning constructors > allocating the memory) probably refers to classes. In case of objects, > constructor does not need to allocate memory because the object is either > declared statically, or it's declared dynamically, but the allocation > happens before the constructor is invoked.
Semantically, yes. Implementation-wise, no: # [13] new(o,init); movl _U_P$PROGRAM_O,%ebx movl L_VMT_P$PROGRAM_TOBJ$non_lazy_ptr,%edx movl $0,%eax call L_P$PROGRAM_TOBJ_$__INIT$$LONGBOOL$stub movl %eax,_U_P$PROGRAM_O The first $0 parameter (in %eax) indicates that memory still has to be reserved. P$PROGRAM_TOBJ_$__INIT$$LONGBOOL (= tobj.init) calls fpc_help_constructor, which allocates the memory if necessary (based on the size in the VMT, and the VMT is loaded in %edx in the code above). Jonas_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal