Issue 2619: operator>> for String_var (cxx_revision) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: The C++ mapping says: A compliant mapping implementation shall provide overloaded operator<< (insertion) and operator>> (extraction) operators for using String_var and String_out directly with C++ iostreams. >From this definition it"s no clear whether operator>> allocates memory or not. That is, is the following code correct? CORBA::String_var str; cin >> str; Resolution: closed/resolved Revised Text: Add the following to the last sentence in Section 1.7 of formal/99-07-41: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting strings from an input stream (extracting until whitespace or end of file). Space to store the extracted characters are allocated by calling string_alloc, and the previous contents of the String_var are released by calling string_free. Add the following to the last sentence in Section 1.8: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting wide strings from an input stream (extracting until whitespace or end of file). Space to store the extracted characters are allocated by calling wstring_alloc, and the previous contents of the WString_var are released by calling wstring_free. Actions taken: April 21, 1999: received issue June 13, 2000: closed issue Discussion: End of Annotations:===== Sender: ml@ooc.ooc.com Date: Wed, 21 Apr 1999 11:26:58 +0000 From: Marc Laukien Organization: Object-Oriented Concepts, Inc. X-Accept-Language: en To: cxx_revision@omg.org CC: issues@omg.org Subject: operator>> for String_var Hi, The C++ mapping says: A compliant mapping implementation shall provide overloaded operator<< (insertion) and operator>> (extraction) operators for using String_var and String_out directly with C++ iostreams. >From this definition it's no clear whether operator>> allocates memory or not. That is, is the following code correct? CORBA::String_var str; cin >> str; Or do I have to do something like the following: CORBA::String_var str; str = CORBA::string_alloc(1000); cin >> str; Cheers, Marc -- Marc Laukien Phone: (978) 439 9285 x 245 Object-Oriented Concepts, Inc. FAX: (978) 439 9286 44 Manning Rd. WWW: http://www.ooc.com Billerica, MA 01821 E-Mail: mailto:ml@ooc.com Date: Wed, 21 Apr 1999 09:39:07 -0400 (EDT) From: Bill Beckwith X-Sender: beckwb@gamma To: Marc Laukien cc: cxx_revision@omg.org Subject: Re: operator>> for String_var On Wed, 21 Apr 1999, Marc Laukien wrote: > > The C++ mapping says: > > A compliant mapping implementation shall provide overloaded > operator<< > (insertion) and operator>> (extraction) operators for using > String_var > and > String_out directly with C++ iostreams. > > >From this definition it's no clear whether operator>> allocates > memory > or not. That is, is the following code correct? > > CORBA::String_var str; > cin >> str; > > Or do I have to do something like the following: > > CORBA::String_var str; > str = CORBA::string_alloc(1000); > cin >> str; Either should result in non-leaking code. The operator is free to reclaim any existing storage if present and allocate a sufficient buffer. The allocation in the second code set is not necessary. -- Bill Sender: jbiggar@floorboard.com Message-ID: <3855A459.123E928E@floorboard.com> Date: Mon, 13 Dec 1999 17:58:49 -0800 From: Jonathan Biggar X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.6 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: cxx_revision@omg.org Subject: More vote 2 proposals (1520, 2619, 2880, 2887 & 2888) Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: b25!!?6Ce9+$-e9m\Ne9 Issue 2619: operator>> for String_var Proposal: Add the following to the last sentence in Section 1.7: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting strings from an input stream. Add the following to the last sentence in Section 1.8: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting wide strings from an input stream. Sender: jon@floorboard.com Message-ID: <3855C2A8.4A3A0B8F@floorboard.com> Date: Mon, 13 Dec 1999 20:08:08 -0800 From: Jonathan Biggar X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.5.1 sun4m) X-Accept-Language: en MIME-Version: 1.0 To: cxx_revision@omg.org Subject: New proposal for 2619 & 2890 References: <3855A459.123E928E@floorboard.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: /Pfd9L3l!!EhY!!6K8e9 > Issue 2619: operator>> for String_var > > Proposal: This should have been for issue 2890, but since 2619 is related, I'm going to try a second time. Issue 2619: operator>> for String_var Issue 2890: String extractor semantics undefined Proposal: Add the following to the last sentence in Section 1.7: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting strings from an input stream (extracting until whitespace or end of file). Space to store the extracted characters are allocated by calling string_alloc, and the previous contents of the String_var are released by calling string_free. Add the following to the last sentence in Section 1.8: The operator>> extraction operator has the same semantics as the underlying standard C++ operator>> for extracting wide strings from an input stream (extracting until whitespace or end of file). Space to store the extracted characters are allocated by calling wstring_alloc, and the previous contents of the WString_var are released by calling wstring_free. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org