RE: Value class initialization rules
- From: dmilirud@xxxxxxxxxxxxxxxxxxxx (Diana Milirud [MSFT])
- Date: Wed, 06 Apr 2005 17:37:50 GMT
George,
Initially, for valuetypes, the rules used to be that each and every valuetype needed to be initiazlied by calling the .ctor, but now we are not as strict and make
no guarantess. Hence, it is not a requirement for a valuetype .ctor to initialize every field.
Also, we now require initlocals to be set for verifiable code so VER_E_THIS_UNINIT_V_RET could be a non-issue any longer.
Thanks,
Diana
--------------------
>Thread-Topic: Value class initialization rules
>thread-index: AcU5rzBZxWs8lx/IT56qCQBzW/ZUTQ==
>X-WBNR-Posting-Host: 129.132.1.4
>From: =?Utf-8?B?R2Vvcmdl?= <George@xxxxxxxxxxxxxxxxxxxxxxxxx>
>References: <2B7EE3DC-76F6-4C4F-A110-A8892A8B8F71@xxxxxxxxxxxxx> <BsEIeKYOFHA.5096@xxxxxxxxxxxxxxxxxxxxx>
>Subject: RE: Value class initialization rules
>Date: Tue, 5 Apr 2005 00:15:04 -0700
>Lines: 34
>Message-ID: <96330760-B9D0-4858-A13D-2A6CADDB1574@xxxxxxxxxxxxx>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.framework.clr
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.clr:3442
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
>
>Diana, thank you for the message.
>
>> Value types do not have "this" pointer.
>
>In ECMA, I found many paragraphs where the value types have a "this" pointer
>and I have no doubt about it.
>
>Here is a paragraph from Partition I, chapter 8.9.7 "Value Type Definition":
>
>"When a non-static method (i.e. an instance or virtual method) is called on
>the value type its this pointer is a managed reference to the instance"
>
>More exactly, the type of the "this" pointer for a value class "vc" is the
>managed pointer "vc&".
>
>My question was referring to the exact time when the "this" pointer in a
>.ctor is considered initialized.
>
>For example, "this" is not considered initialized upon exiting an object
>class ".ctor" that didn't call the base ".ctor". This is one verification
>rule.
>
>My question relative to value classes was triggered after looking at the
>error messages that a verifier can throw. They can be found in the file
>"mscorrc.rc" in Rotor.
>
>It's about this error message: VER_E_THIS_UNINIT_V_RET "Return from ctor
>before all fields are initialized".
>
>When exactly is thrown this error?
>
>Thank you.
>Cheers,
>George
>
--
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
.
- References:
- Value class initialization rules
- From: George
- RE: Value class initialization rules
- From: Diana Milirud [MSFT]
- RE: Value class initialization rules
- From: George
- Value class initialization rules
- Prev by Date: RE: Checking how much an object takes in memory
- Next by Date: Re: Static Variables during Garbage Collection
- Previous by thread: RE: Value class initialization rules
- Next by thread: When is Finalize called?
- Index(es):
Relevant Pages
|