From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23754 invoked by alias); 3 May 2002 18:44:38 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 23717 invoked from network); 3 May 2002 18:44:35 -0000 Received: from unknown (HELO froskur.flaga.is) (193.4.144.1) by sources.redhat.com with SMTP; 3 May 2002 18:44:35 -0000 Received: from kolkrabbi.flaga.is ([192.168.145.6]) by froskur.flaga.is (Post.Office MTA v3.5.3 release 223 ID# 0-71854U100L100S0V35) with ESMTP id is for ; Fri, 3 May 2002 18:44:33 +0000 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: RE: Classic C problems, need help! Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Date: Fri, 03 May 2002 11:44:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: =?iso-8859-1?B?S+FyaSBEYXbt8HNzb24=?= To: "Glover George" , "John Love-Jensen" Cc: X-SW-Source: 2002-05/txt/msg00025.txt.bz2 You don't know. Welcome to the world of C and C++. K.D. > -----Original Message----- > From: Glover George [mailto:dime@gulfsales.com] > Sent: 3. ma=ED 2002 18:39 > To: 'John Love-Jensen' > Cc: gcc-help@gcc.gnu.org > Subject: RE: Classic C problems, need help! >=20 >=20 > I guess that's the problem is how do I know? If the prototype of the > function is (char *someval) does that tell me anything? I mean, other > than well documented function headers, how do I know? >=20 > > -----Original Message----- > > From: gcc-help-owner@gcc.gnu.org=20 > > [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of John Love-Jensen > > Sent: Friday, May 03, 2002 12:50 PM > > To: Glover George > > Cc: gcc-help@gcc.gnu.org > > Subject: Re: Classic C problems, need help! > >=20 > >=20 > > Hi Dime, > >=20 > > What you are running into is the concept known as OWNERSHIP.=20=20 > > I put OWNERSHIP in capitals because it is a very important=20 > > C/C++ detail to get right -- otherwise memory leaks or=20 > > dangling pointers, then Bad Things Happen shortly thereafter.=20 > > Aside: Java gets around the OWNERSHIP problem by having=20 > > garbage collection, pass-by-value for POD and=20 > > pass-by-reference for UDT. > >=20 > > When you pass the char* to the other routine, does it's=20 > > contract say that it is taking OWNERSHIP of that string? And=20 > > thus, is responsible to destruct it, when appropriate. > >=20 > > Or does that other routine merely borrow that string for=20 > > whatever purposes... input only? output only? input/output=20 > > (aka update)? utility or functor (more so for C++ than C)? > >=20 > > Without known the contract that the routine is operating=20 > > under, I cannot tell you your proper course of action. > >=20 > > --Eljay > >=20 > >=20 >=20 >=20