www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Destructor called without constructor in static function (old WDJ bug).

↑ ↓ ← "KarL" <someone somewhere.org> writes:
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Source:
#include <iostream.h>
class foo {public:  static bar() { cout << "bar ";}  foo() {cout << =
"ctor ";}  ~foo() {cout << "dtor\n";}};
void main(){  foo().bar();}
Output
bar dtor
Destructor was called without calling the constructor. This was reported =
in
Windows Development Journal with comments by Ron Burk years ago and
now I think only DMC++ still has this bug.

GNU saying "bar" - perhaps the optimisation is too wonderful to be =
true...

VC++ and BCC32 says "ctor bar dtor" which object was created and =
destroyed.=20
Aug 06 2002
↑ ↓ "Walter" <walter digitalmars.com> writes:
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Does Ron have a web page for this (i.e. are there other tests of =
interest?)?
  "KarL" <someone somewhere.org> wrote in message =
news:aiq9u1$m0r$1 digitaldaemon.com...
  Source:
#include <iostream.h>
class foo {public:  static bar() { cout << "bar ";}  foo() {cout << =
"ctor ";}  ~foo() {cout << "dtor\n";}};
void main(){  foo().bar();}
  Output
bar dtor
  Destructor was called without calling the constructor. This was =
reported in
  Windows Development Journal with comments by Ron Burk years ago and
  now I think only DMC++ still has this bug.

  GNU saying "bar" - perhaps the optimisation is too wonderful to be =
true...

  VC++ and BCC32 says "ctor bar dtor" which object was created and =
destroyed.=20
Aug 07 2002
↑ ↓ → "KarL" <someone somewhere.org> writes:
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Unfortunately Ron has left WDJ and WDJ is now called wd-mag and I =
stopped
my subscriptions because the journal is bad now.

The file date of the source sayd 4th December 1995 so the bug is really =
really old.

I'll try to dig the article out from my boxes from home and forward it =
you.

Cheers...
  Walter <walter digitalmars.com> wrote in message =
news:aise6g$24el$2 digitaldaemon.com...
  Does Ron have a web page for this (i.e. are there other tests of =
interest?)?
    "KarL" <someone somewhere.org> wrote in message =
news:aiq9u1$m0r$1 digitaldaemon.com...
    Source:
#include <iostream.h>
class foo {public:  static bar() { cout << "bar ";}  foo() {cout << =
"ctor ";}  ~foo() {cout << "dtor\n";}};
void main(){  foo().bar();}
    Output
bar dtor
    Destructor was called without calling the constructor. This was =
reported in
    Windows Development Journal with comments by Ron Burk years ago and
    now I think only DMC++ still has this bug.
    =20
    GNU saying "bar" - perhaps the optimisation is too wonderful to be =
true...

    VC++ and BCC32 says "ctor bar dtor" which object was created and =
destroyed.=20
Aug 07 2002