Re: ECMA Wrong - Class and Object Initialization Rules - Help!

Tech-Archive recommends: Fix windows errors by optimizing your registry



'Initialization' in this context has only to do with the state of the
object, specifically the state of whether constructors have been called.

Your recursive example is verifiable because it will never return without
calling the base class constructor. Of course, it will never return,
period.

The 'uninitialized this on entering a try block' restriction is implemented
in PEVerify and the x64 & Itanium JIT verifiers for Whidbey Beta2. I
believe it is being considered for inclusion in ECMA.


"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D0D8921D-3CA7-45B9-9DC4-9426F19B370F@xxxxxxxxxxxxxxxx
> Hi,
>
> ECMA states in Section 1.8.1.4 (Partition III) on Class and Object
> Initialization Rules:
>
> "An object constructor shall not return unless a constructor for the base
> class or a different construct for the object's class has been called on
> the
> newly constructed object. The verification algorithm shall treat the this
> pointer as uninitialized unless the base class constructor has been
> called."
>
> This means in particular that, if a .ctor didn't invoke a base class .ctor
> but another .ctor of the same class, then the "this" pointer is not
> initialized. For example, class A has 2 .ctors that invoke eachother:
> recursive constructor invocation is allowed at the bytecode level!
>
> BUT, the examples I tried show that the "this" pointer is initialized even
> after invoking another .ctor of the same class - for example I can load
> the
> "this" into a local variable.
>
> SO, it seems to me that the "this" is considered initialized also after
> invoking a ctor of the same class and NOT ONLY a ctor of the base class!
>
> ====================================
>
> There is another issue which is not clear.
>
> Looking in the ROTOR source, I found the following commented idea:
>
> "If there are any locals (or arg slot 0) containing uninit vars, it is
> illegal to be in a try block."
>
> This corresponds to error "VER_E_THIS_UNINIT_EXCEP" "Uninitialized this on
> entering a try block"
>
> Beside the fact that this is not documented in ECMA, I cannot have it
> confirmed by examples.
>
> Is this verification error still checked in the current version of the
> verifier?
>
> Many thanks for any help!
>
> George


.



Relevant Pages

  • Virtual base class
    ... no matter direct virtual base class or not, ... what means "and only for the constructor of the most ... Initialization shall proceed in the following order: ...
    (microsoft.public.vc.language)
  • Re: Message Builder vs. a Build Method?
    ... Builder class would encapsulate all the complex algorithms for making ... OTOH, as Daniel T. suggests, sometimes the initialization requires unique processing for initialization that is clearly intrinsic to the object itself. ... Constructors tend to be fragile and it is difficult to manage errors when they occur in a constructor scope, so it is usually a good idea to keep the processing in constructors as simple as possible. ... When the initialization of attribute data requires complex processing AND it seems like is intrinsic ot the object, that justifies having a separate initialization method that is invoked immediately after the constructor. ...
    (comp.object)
  • RE: ECMA Wrong - Class and Object Initialization Rules - Help!
    ... An instance of a class can be created only if the constructor of the class' ... > Initialization Rules: ... > pointer as uninitialized unless the base class constructor has been called." ... > This means in particular that, if a .ctor didn't invoke a base class .ctor ...
    (microsoft.public.dotnet.framework.clr)
  • ECMA Wrong - Class and Object Initialization Rules - Help!
    ... ECMA states in Section 1.8.1.4 on Class and Object ... Initialization Rules: ... "An object constructor shall not return unless a constructor for the base ... if a .ctor didn't invoke a base class .ctor ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Localization Service
    ... these assets are contents to be edited by the users. ... problem with a validatorFactory. ... I was filling the dictionary on the constructor. ... beware of too much deferred initialization. ...
    (microsoft.public.dotnet.languages.csharp)