Issue 6163: _var's and valuetypes (cxx_revision) Source: Oracle (Dr. Andrew Piper, andyp(at)bea.com) Nature: Uncategorized Issue Severity: Summary: 1.9.1 says: "The copy constructor deep-copies any data pointed to by the T_var constructor parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Compliant implementations may, but are not required to, utilize some form of reference counting to avoid such copies." and "The normal assignment operator deep-copies any data pointed to by the T_var assignment parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Assigning a null pointer to a T_var is legal and results in deallocation of the data pointed to by the T_var." So my question is, is it legal to use ValueBase::_add_ref() and _remove_ref() instead of _copy_value() in this instance when T_var is representing a valuetype? Resolution: Revised Text: Actions taken: September 11, 2003: received issue Discussion: deferred in June 2011 to the next RTF End of Annotations:===== X-Sender: andyp:san-francisco.beasys.com@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.0 Date: Thu, 11 Sep 2003 12:46:47 -0700 To: cxx_revision@omg.org From: Andy Piper Subject: _var's and valuetypes Cc: issues@omg.org, little@bea.com 1.9.1 says: "The copy constructor deep-copies any data pointed to by the T_var constructor parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Compliant implementations may, but are not required to, utilize some form of reference counting to avoid such copies." and "The normal assignment operator deep-copies any data pointed to by the T_var assignment parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Assigning a null pointer to a T_var is legal and results in deallocation of the data pointed to by the T_var." So my question is, is it legal to use ValueBase::_add_ref() and _remove_ref() instead of _copy_value() in this instance when T_var is representing a valuetype? Thanks andy Date: Thu, 11 Sep 2003 14:18:23 -0700 From: Jonathan Biggar User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en To: cxx-revision@omg.org Subject: Re: _var's and valuetypes Andy Piper wrote: 1.9.1 says: "The copy constructor deep-copies any data pointed to by the T_var constructor parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Compliant implementations may, but are not required to, utilize some form of reference counting to avoid such copies." and "The normal assignment operator deep-copies any data pointed to by the T_var assignment parameter. This copy will be destroyed when the T_var is destroyed or when a new value is assigned to it. Assigning a null pointer to a T_var is legal and results in deallocation of the data pointed to by the T_var." So my question is, is it legal to use ValueBase::_add_ref() and _remove_ref() instead of _copy_value() in this instance when T_var is representing a valuetype? 1.9.1 applies to the structured types: struct, union and sequence. It does not apply to valuetypes. The spec does not specifically say how _var types for valuetypes behave, but using 1.17.13 as a reference, I think the only conclusion is that assignment for valetype _var classes uses _add_ref() and _remove_ref(), never _copy_value(). -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Subject: RE: _var's and valuetypes Date: Thu, 11 Sep 2003 18:59:44 -0400 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: _var's and valuetypes Thread-Index: AcN4rlnEYUuHaiMVRTqGw2fD5UfruAABzMFA From: "Vinoski, Stephen" To: "Jonathan Biggar" Cc: X-MIME-Autoconverted: from quoted-printable to 8bit by amethyst.omg.org id h8BMx8e4007847 >From what I recall, Jon is correct. (When isn't he?) _var types for valuetypes were intended to use reference counting, and _copy_value is there for when you need an actual copy of a valuetype instance. I agree this should be better specified. --steve -----Original Message----- From: Jonathan Biggar [mailto:jon@floorboard.com] Sent: Thursday, September 11, 2003 5:18 PM To: cxx-revision@omg.org Subject: Re: _var's and valuetypes Andy Piper wrote: > 1.9.1 says: > > "The copy constructor deep-copies any data pointed to by the T_var > constructor > parameter. This copy will be destroyed when the T_var is destroyed or > when a new > value is assigned to it. Compliant implementations may, but are not > required to, utilize > some form of reference counting to avoid such copies." > > and > > "The normal assignment operator deep-copies any data pointed to by the > T_var > assignment parameter. This copy will be destroyed when the T_var is > destroyed or > when a new value is assigned to it. Assigning a null pointer to a T_var > is legal and > results in deallocation of the data pointed to by the T_var." > > So my question is, is it legal to use ValueBase::_add_ref() and > _remove_ref() instead of _copy_value() in this instance when T_var is > representing a valuetype? 1.9.1 applies to the structured types: struct, union and sequence. It does not apply to valuetypes. The spec does not specifically say how _var types for valuetypes behave, but using 1.17.13 as a reference, I think the only conclusion is that assignment for valetype _var classes uses _add_ref() and _remove_ref(), never _copy_value(). -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org