www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - dmc 8.40.2n introduces a problem with stlsoft rectarr.cpp

reply Mario <Mario_member pathlink.com> writes:
Hi,

the update from dmc 8.38.9n to 8.40.2n introduced a problem with the stlsoft
example form ddj rectarr.cpp. Just in case I have added th file ...

In both cases it's the same stlsoft lib which comes with the 8.38 CD version.
Only the compiler was updated.

D:\mario\src\cc\palooza\speed4>dmc -DSTRINGTOK_STLSOFT -o+speed -Id:\mario\dm\st
lsoft -odmc_rectarr.exe rectarr.cpp
link rectarr,dmc_rectarr.exe,,user32+kernel32/noi;

Digital Mars C/C++ Compiler Version 8.38.9n
Copyright (C) Digital Mars 2000-2003.  All Rights Reserved.
Written by Walter Bright
www.digitalmars.com

C:\mario\src\cc\palooza\speed4>dmc -DSTRINGTOK_STLSOFT -o+speed
-Ic:\mario\dm\stlsoft -odmc_rectarr.exe rectarr.cpp
c:\mario\dm\stlsoft\stlsoft_iterator.h(675) : Error: function expected
Internal error: template 1902
--- errorlevel 1

Digital Mars C/C++ Compiler Version 8.40.2n
Copyright (C) Digital Mars 2000-2004.  All Rights Reserved.
Written by Walter Bright
www.digitalmars.com


Thanks in advance

-- Mario
Mar 31 2004
parent reply "Matthew" <matthew stlsoft.org> writes:
Mario

I'm pretty sure this is a flaw with DMC++'s handling of static initialiser
objects (aka Schwarz Counter's). I've mentioned it before to Walter, and
there was a workaround built into various headers - look for
s_performance_counter_class_constructor in winstl_performance_counter.h -
but it looks like 8.40 makes the problem even worse, as the workaround no
longer works at all.

If I can isolate it down sufficiently, I'll post a sample bug on the C++
newsgroup, and hopefully a fix can go in 8.41.

For the moment, the answer is simply to comment out both definitions of
s_performance_counter_class_constructor in winstl_performance_counter.h.
(There's also a similar use of initialisers in
winstl_high_performance_counter.h.)

Cheers

Matthew


"Mario" <Mario_member pathlink.com> wrote in message
news:c4e9kp$1acb$1 digitaldaemon.com...
 Hi,

 the update from dmc 8.38.9n to 8.40.2n introduced a problem with the

 example form ddj rectarr.cpp. Just in case I have added th file ...

 In both cases it's the same stlsoft lib which comes with the 8.38 CD

 Only the compiler was updated.

m\st
 lsoft -odmc_rectarr.exe rectarr.cpp
 link rectarr,dmc_rectarr.exe,,user32+kernel32/noi;

 Digital Mars C/C++ Compiler Version 8.38.9n
 Copyright (C) Digital Mars 2000-2003.  All Rights Reserved.
 Written by Walter Bright
 www.digitalmars.com

 C:\mario\src\cc\palooza\speed4>dmc -DSTRINGTOK_STLSOFT -o+speed
 -Ic:\mario\dm\stlsoft -odmc_rectarr.exe rectarr.cpp
 c:\mario\dm\stlsoft\stlsoft_iterator.h(675) : Error: function expected
 Internal error: template 1902
 --- errorlevel 1

 Digital Mars C/C++ Compiler Version 8.40.2n
 Copyright (C) Digital Mars 2000-2004.  All Rights Reserved.
 Written by Walter Bright
 www.digitalmars.com


 Thanks in advance

 -- Mario

Apr 11 2004
parent Scott Michel <scottm mordred.cs.ucla.edu> writes:
In c++ Matthew <matthew stlsoft.org> wrote:
 Mario
 
 I'm pretty sure this is a flaw with DMC++'s handling of static initialiser
 objects (aka Schwarz Counter's). I've mentioned it before to Walter, and
 there was a workaround built into various headers - look for
 s_performance_counter_class_constructor in winstl_performance_counter.h -
 but it looks like 8.40 makes the problem even worse, as the workaround no
 longer works at all.

I wasn't really able to parse the bug here, but if it's something along the lines of "static objects don't get constructed", e.g.: ---- myfile.cxx ---- #include <iostream> struct wombat { wombat(int c_arg) { std::cout << "wombat ctor, carg = " << c_arg << std::endl; } ~wombat() { }; }; static wombat private_marsupial_thingy(1); ---- end of file ---- In the 8.38 compiler, "wombat ctor, carg = 1" wasn't printed b/c static objects' ctors didn't get called. The workaround is to use anonymous namespaces, e.g.: namespace { wombat private_marsupial_thingy(1); }; or upgrade to 8.39. -scooter
Apr 12 2004