473,473 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Please vote: C++ compiler bug - destructor called twice

5 1079
no****@cristalink.com wrote:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK16272


Is this a simplification of the problem you posted a couple days ago with
the subject "compiler bug", or is this a new issue?

-cd
Nov 17 '05 #2
Carl Daniel [VC++ MVP] wrote:
Is this a simplification of the problem you posted a couple days ago with
the subject "compiler bug", or is this a new issue?

What's going on with this voting system anyway? Myself have submitted a
bug of VC++ 2005 Express Beta 1. If it is not voted by someone else, it
will not be fixed?

--
Ioannis Vranos
Nov 17 '05 #3
Ioannis Vranos wrote:
Carl Daniel [VC++ MVP] wrote:
Is this a simplification of the problem you posted a couple days ago
with the subject "compiler bug", or is this a new issue?

What's going on with this voting system anyway? Myself have submitted
a bug of VC++ 2005 Express Beta 1. If it is not voted by someone
else, it will not be fixed?


Not at all. Bugs with more votes are more likely to be acted on sooner,
that's all.

-cd
Nov 17 '05 #4
It's a simplification. The old code didn't go through the voting system
probably because of another bug. The problem is even worse than I thought
before. I am just unable to use mixed managed/unmanaged code, especially
with another bug with wcschr(). Who knows how many other bugs are there!

I wonder whether it's possible to get a hotfix from Microsoft? They don't
seem to want to fix VC7.1. I am pretty sure 8.0 will contain a lot of new
bugs, and it's at least a half of a year away.
// Compile with "cl /clr bug.cpp"

#include <iostream>
using namespace std;

struct A
{
A() { cout << "A() " << this << endl; }
A( const A& ) { cout << "A(A) " << this << endl; }
~A() { cout << "~A() " << this << endl; }

};

#pragma unmanaged // Comment out to fix the problem

void foo( A o ) { cout << "foo" << endl; }

#pragma managed

void main()
{
cout << "Before foo" << endl;
foo( A() ); cout << "After foo" << endl;
}

Results:

Before foo
A() 0012F584
~A() 0012F584
foo
~A() 0012F500
After foo


"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:uG**************@TK2MSFTNGP15.phx.gbl...
no****@cristalink.com wrote:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK16272


Is this a simplification of the problem you posted a couple days ago with
the subject "compiler bug", or is this a new issue?

-cd

Nov 17 '05 #5
The best guidance I can give for 7.0 and 7.1 is to not pass by value any c++
objects with construction and destruction semantics that aren't idempotent
through an IJW interop boundary.

We are fixing this (it isn't in any current drop yet) for Whidbey. There is
absolutely no way to fix it for earlier versions since it requires changes
in the C++ compiler, the metadata and the CLR interop layer.

Ronald Laeremans
Visual C++ team

"no****@cristalink.com" <cr********@nospam.nospam> wrote in message
news:u9**************@TK2MSFTNGP14.phx.gbl...
It's a simplification. The old code didn't go through the voting system
probably because of another bug. The problem is even worse than I thought
before. I am just unable to use mixed managed/unmanaged code, especially
with another bug with wcschr(). Who knows how many other bugs are there!

I wonder whether it's possible to get a hotfix from Microsoft? They don't
seem to want to fix VC7.1. I am pretty sure 8.0 will contain a lot of new
bugs, and it's at least a half of a year away.
// Compile with "cl /clr bug.cpp"

#include <iostream>
using namespace std;

struct A
{
A() { cout << "A() " << this << endl; }
A( const A& ) { cout << "A(A) " << this << endl; }
~A() { cout << "~A() " << this << endl; }

};

#pragma unmanaged // Comment out to fix the problem

void foo( A o ) { cout << "foo" << endl; }

#pragma managed

void main()
{
cout << "Before foo" << endl;
foo( A() ); cout << "After foo" << endl;
}

Results:

Before foo
A() 0012F584
~A() 0012F584
foo
~A() 0012F500
After foo


"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:uG**************@TK2MSFTNGP15.phx.gbl...
no****@cristalink.com wrote:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK16272


Is this a simplification of the problem you posted a couple days ago with
the subject "compiler bug", or is this a new issue?

-cd


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alexander Stippler | last post by:
Hi, I have some question about the usage of delete. I have some reference counted classes, all derived from SharedObject. It's destructor looks like this: ~SharedObject() { if...
52
by: Newsnet Customer | last post by:
Hi, Statement 1: "A dynamically created local object will call it's destructor method when it goes out of scope when a procedure returms" Agree. Statement 2: "A dynamically created object...
4
by: Warwick | last post by:
Hi I could use some help with inheritance and destructors. I have been following an example in a book and the example has lead to a situation which I have reduced to a contrived example that...
20
by: frs | last post by:
For memory economization, I need to get rid if the virtual destructor. Under this constraint I get caught up in a design, where I need to call a destructor of a derived class from a base class....
6
by: Tommy Andreasen | last post by:
Hi, I have the following code: -------------------------------------- #include <iostream> class MyObj { public: MyObj()
14
by: gurry | last post by:
Suppose there's a class A. There's another class called B which looks like this: class B { private: A a; public : B() { a.~A() } }
2
by: Kuku | last post by:
#include<iostream> using namespace std; class Mammal { private: int age, weight;
11
by: AB | last post by:
Hi All, I've got an array of objects, during the execution of the program I'd like to assign a particular object to a certain element in the object array. The sample code's like this... class...
4
by: David | last post by:
Hi all, something wrong with my code, it seems that the destructor function has been called twice. I don't know why.here is my codes Fixture.h #ifndef _FIXTURE_H #define _FIXTURE_H #include...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.