Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Apr 2001 13:07:02 -0700
From:      "David O'Brien" <obrien@freebsd.org>
To:        Marcin Gryszkalis <dagoon@math.uni.lodz.pl>
Cc:        freebsd-alpha@freebsd.org
Subject:   Re: gperf segfail on 4.3b
Message-ID:  <20010401130702.A60525@dragon.nuxi.com>
In-Reply-To: <Pine.BSF.4.21.0104011746530.45419-100000@imul.math.uni.lodz.pl>; from dagoon@math.uni.lodz.pl on Sun, Apr 01, 2001 at 05:54:42PM %2B0200
References:  <Pine.BSF.4.21.0104011540330.45419-100000@imul.math.uni.lodz.pl> <Pine.BSF.4.21.0104011746530.45419-100000@imul.math.uni.lodz.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Apr 01, 2001 at 05:54:42PM +0200, Marcin Gryszkalis wrote:
> Ok, seems like I have a real problem: this source:
> -----------------------------------------------
> gives 'CCWWWD' as result while it should 'CCCWWWDD'. Constructor and
> destructor for d0 are NOT called.

How do you know which ctor/dtor is being called with the way you wrote
this?  Try this version:

#include <stdio.h>
class dg { 
        char *n;
public: dg(){n=""; puts("C'");}
        dg(char *s){n=s; printf("C%s\n",n);}
		~dg() {printf("D%s\n",n);} 
void work(char *s){printf("W%s\n",s);}
};

dg d0("0");
int main (int argc, char *argv[])
{
dg d1("1");
dg *d2=new dg("2");
d0.work("0"); d1.work("1"); d2->work("2");
return 0;
}


I believe you mean dtor for d2 NOT called -- you never delete the
pointer, so how could it get called?

x86 -current:    C0 C1 C2 W0 W1 W2 D1 D0
x86 4.3-RC#2:    C0 C1 C2 W0 W1 W2 D1 D0
Alpha 4.3-RC#2:  C0 C1 C2 W0 W1 W2 D1 D0


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010401130702.A60525>