From owner-freebsd-libh Tue Dec 4 10:33:24 2001 Delivered-To: freebsd-libh@freebsd.org Received: from tomts14-srv.bellnexxia.net (tomts14.bellnexxia.net [209.226.175.35]) by hub.freebsd.org (Postfix) with ESMTP id 5D23D37B417 for ; Tue, 4 Dec 2001 10:33:19 -0800 (PST) Received: from khan.anarcat.dyndns.org ([65.94.190.39]) by tomts14-srv.bellnexxia.net (InterMail vM.4.01.03.16 201-229-121-116-20010115) with ESMTP id <20011204183318.XZWZ16262.tomts14-srv.bellnexxia.net@khan.anarcat.dyndns.org> for ; Tue, 4 Dec 2001 13:33:18 -0500 Received: from shall.anarcat.dyndns.org (shall.anarcat.dyndns.org [192.168.0.1]) by khan.anarcat.dyndns.org (Postfix) with ESMTP id D935C1A6A for ; Tue, 4 Dec 2001 13:37:52 -0500 (EST) Received: by shall.anarcat.dyndns.org (Postfix, from userid 1000) id D26B720ACD; Tue, 4 Dec 2001 13:34:52 -0500 (EST) Date: Tue, 4 Dec 2001 13:34:52 -0500 From: The Anarcat To: Libh Subject: File constructors Message-ID: <20011204183451.GC2922@shall.anarcat.dyndns.org> Mail-Followup-To: The Anarcat , Libh Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="69pVuxX8awAiJ7fD" Content-Disposition: inline User-Agent: Mutt/1.3.23.2i Sender: owner-freebsd-libh@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --69pVuxX8awAiJ7fD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Boy, I'm getting rusty at C++ now..=20 Ahem, I'm trying to fix (yes fix) the File constructor. The simpler one (File()) doesn't initialize mFile so when it tries to close it, it crashes. There is a simple fix, but I think the more general one is to use a single constructor with a default value: File::File( const string& aUrl =3D "") : mUrl( aUrl ), mRemoveOnClose( false ), mFile(NULL) However, it doesn't really work. I made a little test program for the File class, since I'm tearing it apart; I want to see if it still works. ;) c++ -g -fpic -DPIC -I/usr/local/include/tcl8.3 -g -I../../../include -D= HSYSTEM_FILE -DHSYSTEM_DISK -DHSYSTEM_HUI -DHSYSTEM_SYSINSTALL -DHSYSTEM_DA= TABASE -DSTATIC -c test_stub.cc cc -g -fpic -DPIC -I/usr/local/include/tcl8.3 -o test_stub test_stub.o = -L../../../compile/none/ -L../../../lib/tcl -L../../../lib/common -lhtcl -= lh -L/u/anarcat/libh/lib/file/test -L../../../lib/file -lhtclfile -lhfile -= L../../../lib/disk -lhtcldisk -lhdisk -L../../../lib/hui -lhtclhui -lhui -L= ../../../lib/sysinstall -lhtclsysinstall -lhsysinstall -L../../../lib/datab= ase -lhdatabase -lstdc++ -ldisk -lfetch -lz -lcom_err -lm -ltcl83 -L/usr/lo= cal/lib -lm =2E./../../compile/none//libhfile.so: warning: mktemp() possibly used unsaf= ely; consider using mkstemp() =2E./../../compile/none//libhfile.so: undefined reference to `File::File(in= t)' Now there is so much meta-language stuff in libh that I have a hard time tracing this back. And I don't remember if using a default is a proper way. It does seem so to me, but I remember having problems with that in the past too. Needless to say, I don't know why or how libhfile would access File(int). It does not make any sort of sense. Anyways, i'll just make 2 constructors. It's just that the error of not initializing mFile was made in only one of the two, and having a single constructor helps avoiding this kind of error. a. --69pVuxX8awAiJ7fD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iEYEARECAAYFAjwNF0oACgkQttcWHAnWiGe8HQCeIe/6yGR0zQ+xAd8te+SBC20D 1usAn1RapYppB1ITS2AT/hsq81U8g5Ae =0pJy -----END PGP SIGNATURE----- --69pVuxX8awAiJ7fD-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-libh" in the body of the message