U
U.Mutlu
Can you imagine:
What would happen if your destructors aren't get called?
Today I encountered a very subtile bug in Microsoft's VS2008:
in my case the destructor of a globally used class isn't called
if the implementation of the destructor is in the cpp-file
and it is part of a library project.
It gets called only when the dtor code is in the h-file!
Disabling optimization and intrinsic stuff all has no effect on this,
it's an unbelievable bug!
A research on the net revealed that this bug is known to Microsoft
since at least 4/1/2008 as this MS-page indicates:
http://connect.microsoft.com/VisualStudio/feedback/details/336316
There a poster has written this:
"
Posted by Joshua Maurice on 3/16/2010 at 5:49 PM
I am going to be pushing my company to not use the visual studios
compiler suite and drop all MSDN licenses because of this
incredibly broken compiler optimization. C++'s fundamental
underpinning is the automatic calling of destructors of
stack objects, member sub-objects, etc. This is the very first
thing added to C to make C++, and it is the most important
defining quality of C++, aka RAII. Because the compiler
bungles such a basic case, and because you prioritize it
so lowly makes me question whether or not visual studios is the
appropriate place to spend our money for a quality product.
Put another way, if we are unable to ship optimized builds
without fear of memory leaks, then we're left with:
1- Don't use RAII, or basically don't program using standard C++.
2- Don't ship optimized builds.
3- Ship broken builds.
4- Don't use visual studios. Aka use gcc or some alternative.
The only reason my company currently uses visual studios, and buys
the MSDN licenses, is because it is a superior optimizing compiler.
However, we will not use an optimizing compiler if it affects correctness.
In our line of work, basically any coding besides games, correctness
matters most. Thus, if our choices are the above, 1 is not practical
due to time to market costs, 3 is not acceptable, and 4 is preferable
to 2, because although visual studios might optimize better when it
doesn't break cases, I bet gcc will optimize better vs visual studios
with all the optimizations turned off, thus obviating the only reason
to use visual studios over gcc.
I suggest you seriously rethink your business strategy. No one will put up
with a nonstandard C++ compiler which misses the entire point of C++.
"
It is interessting how Microsoft gives a very low priority to this unbelievable bug,
just see yourself the answers at the above link. Unbelievable!
How can Microsoft sell such a buggy product and call it "C++ compiler"?
What would happen if your destructors aren't get called?
Today I encountered a very subtile bug in Microsoft's VS2008:
in my case the destructor of a globally used class isn't called
if the implementation of the destructor is in the cpp-file
and it is part of a library project.
It gets called only when the dtor code is in the h-file!
Disabling optimization and intrinsic stuff all has no effect on this,
it's an unbelievable bug!
A research on the net revealed that this bug is known to Microsoft
since at least 4/1/2008 as this MS-page indicates:
http://connect.microsoft.com/VisualStudio/feedback/details/336316
There a poster has written this:
"
Posted by Joshua Maurice on 3/16/2010 at 5:49 PM
I am going to be pushing my company to not use the visual studios
compiler suite and drop all MSDN licenses because of this
incredibly broken compiler optimization. C++'s fundamental
underpinning is the automatic calling of destructors of
stack objects, member sub-objects, etc. This is the very first
thing added to C to make C++, and it is the most important
defining quality of C++, aka RAII. Because the compiler
bungles such a basic case, and because you prioritize it
so lowly makes me question whether or not visual studios is the
appropriate place to spend our money for a quality product.
Put another way, if we are unable to ship optimized builds
without fear of memory leaks, then we're left with:
1- Don't use RAII, or basically don't program using standard C++.
2- Don't ship optimized builds.
3- Ship broken builds.
4- Don't use visual studios. Aka use gcc or some alternative.
The only reason my company currently uses visual studios, and buys
the MSDN licenses, is because it is a superior optimizing compiler.
However, we will not use an optimizing compiler if it affects correctness.
In our line of work, basically any coding besides games, correctness
matters most. Thus, if our choices are the above, 1 is not practical
due to time to market costs, 3 is not acceptable, and 4 is preferable
to 2, because although visual studios might optimize better when it
doesn't break cases, I bet gcc will optimize better vs visual studios
with all the optimizations turned off, thus obviating the only reason
to use visual studios over gcc.
I suggest you seriously rethink your business strategy. No one will put up
with a nonstandard C++ compiler which misses the entire point of C++.
"
It is interessting how Microsoft gives a very low priority to this unbelievable bug,
just see yourself the answers at the above link. Unbelievable!
How can Microsoft sell such a buggy product and call it "C++ compiler"?