c++.stl - STL & namespaces?
- Peter Dickinson (9/9) Feb 05 2002 I am new to Digital Mars C++, and I'm trying it out with some code that
- Walter (6/15) Feb 06 2002 DMC++ supports namespaces as of the ARM, but not as of the latest STL. I...
- Olivier Mascia (15/18) Jul 29 2003 Taking into account the large number of programs using STL through std::...
- Walter (6/22) Jul 29 2003 prefix
- Olivier Mascia (17/25) Jul 30 2003 Walter, I understood the message was *old*, but it was very actual to my...
- Olivier Mascia (27/31) Jul 30 2003 More precisely, I see that in stl/stl_config.h the settings for DMC are
- Olivier Mascia (4/8) Jul 30 2003 Walter, see the attached small test code demonstrating my issues.
- Olivier Mascia (14/15) Jul 30 2003 I have now installed STLPort as available from digitalmars web site.
- Olivier Mascia (6/16) Jul 30 2003 This error went away when I removed my -H and -HF flags.
- Walter (5/20) Jul 30 2003 Reporting internal errors here is fine, or emailing them to me works fin...
- Olivier Mascia (5/5) Jul 30 2003 Yet another bug, this one produces a crash of the compiler.
- Olivier Mascia (24/25) Jul 30 2003 Answering to myself: trying to compile any *serious* code with the STL
- Walter (6/29) Jul 30 2003 :)
- Matthew Wilson (33/52) Jul 29 2003 You can include the STLSoft root header stlsoft.h, and qualify with
I am new to Digital Mars C++, and I'm trying it out with some code that expects the STL to be in the std namespace (I'm trying the regression test from the Boost libraries - www.boost.org). I noticed in stl_config.h, that the DM compiler does not define __STL_HAS_NAMESPACES, and when I try to use it, I get various compilation errors. Is there something I need to do to work with the STL in DM? Or is there a workaround for code that wants the STL to be in the std namespace? Thanks, Pete Dickinson
Feb 05 2002
DMC++ supports namespaces as of the ARM, but not as of the latest STL. It will eventually support it, but not yet. Sorry. -Walter "Peter Dickinson" <petedgr8 yahoo.com> wrote in message news:a3qa03$1tkk$1 digitaldaemon.com...I am new to Digital Mars C++, and I'm trying it out with some code that expects the STL to be in the std namespace (I'm trying the regression test from the Boost libraries - www.boost.org). I noticed in stl_config.h,thatthe DM compiler does not define __STL_HAS_NAMESPACES, and when I try touseit, I get various compilation errors. Is there something I need to do to work with the STL in DM? Or is there a workaround for code that wants the STL to be in the std namespace? Thanks, Pete Dickinson
Feb 06 2002
In article <a3qqj5$250g$1 digitaldaemon.com>, Walter says...Taking into account the large number of programs using STL through std:: prefix a bit everywhere like in the following : #include <string> int main(int, char*[]) { std::string a; .. } doesn't this look like a very *serious* limitation ? Short of editing thousands of 'std::' prefixes how would you recommend porting existing code using STL to DMC ? Thanks for suggestions, -- Olivier Masciathe DM compiler does not define __STL_HAS_NAMESPACESDMC++ supports namespaces as of the ARM, but not as of the latest STL. It will eventually support it, but not yet. Sorry. -Walter
Jul 29 2003
"Olivier Mascia" <Olivier_member pathlink.com> wrote in message news:bg6snj$2l81$1 digitaldaemon.com...In article <a3qqj5$250g$1 digitaldaemon.com>, Walter says...prefixTaking into account the large number of programs using STL through std::the DM compiler does not define __STL_HAS_NAMESPACESDMC++ supports namespaces as of the ARM, but not as of the latest STL. It will eventually support it, but not yet. Sorry. -Waltera bit everywhere like in the following : #include <string> int main(int, char*[]) { std::string a; .. } doesn't this look like a very *serious* limitation ? Short of editing thousands of 'std::' prefixes how would you recommendportingexisting code using STL to DMC ?No problem, since DMC++ now supports namespaces. The message you replied to is about a year and a half old. -Walter
Jul 29 2003
Walter wrote:Walter, I understood the message was *old*, but it was very actual to my findings. I cannot find the way to set the thing up to successfully compile a piece of code using STL which cross-compile successfully between GCC 3.2 (on linux, mingw and cygwin), Borland Builder 6, Microsoft Visual Studio. Without defining __STL_HAS_NAMESPACES I always end-up with 'string' not defined in std namespace. And with __STL_HAS_NAMESPACES I get other compile errors (the first one while including <vector>. Should I better use the stl provided with dmc or add STLport ? Or whatever ? I'm currently testing using the free downloadable compiler but will buy some CDs if I can get this to compile (and run). Thanks, -- Olivier Mascia#include <string> int main(int, char*[]) { std::string a; .. }No problem, since DMC++ now supports namespaces. The message you replied to is about a year and a half old. -Walter
Jul 30 2003
Olivier Mascia wrote:Without defining __STL_HAS_NAMESPACES I always end-up with 'string' not defined in std namespace. And with __STL_HAS_NAMESPACES I get other compile errors (the first one while including <vector>.More precisely, I see that in stl/stl_config.h the settings for DMC are still defined as this : www.digitalmars.com */ This does not properly place the STL things in std as should be done by default. Adding there or defining on command-line __STL_HAS_NAMESPACES introduces compilation bugs on some STL includes. -- Olivier Mascia
Jul 30 2003
Olivier Mascia wrote:Without defining __STL_HAS_NAMESPACES I always end-up with 'string' not defined in std namespace. And with __STL_HAS_NAMESPACES I get other compile errors (the first one while including <vector>.Walter, see the attached small test code demonstrating my issues. -- Olivier Mascia
Jul 30 2003
Olivier Mascia wrote:Walter, see the attached small test code demonstrating my issues.I have now installed STLPort as available from digitalmars web site. I have much better results with it. My test code compiles. Though on the real project I want to compile, it fails with: Internal error: ph 1111 on the very first unit I compile. What is this error related with ? So that I can try to write a smaller test case to demonstrate it. Side question : on which group should I report things like an Internal error ? Thanks, -- Olivier Mascia
Jul 30 2003
Olivier Mascia wrote:I have now installed STLPort as available from digitalmars web site. I have much better results with it. My test code compiles. Though on the real project I want to compile, it fails with: Internal error: ph 1111 on the very first unit I compile. What is this error related with ?This error went away when I removed my -H and -HF flags. So it seems related to precompiled symbols handling. But I could work around it. -- Olivier Mascia
Jul 30 2003
Reporting internal errors here is fine, or emailing them to me works fine too. The most important thing is to provide a reproducible example. Otherwise, they are essentially impractical to fix. -Walter "Olivier Mascia" <om-removethis tipgroup.com> wrote in message news:bg8fa5$18do$1 digitaldaemon.com...Olivier Mascia wrote:Walter, see the attached small test code demonstrating my issues.I have now installed STLPort as available from digitalmars web site. I have much better results with it. My test code compiles. Though on the real project I want to compile, it fails with: Internal error: ph 1111 on the very first unit I compile. What is this error related with ? So that I can try to write a smaller test case to demonstrate it. Side question : on which group should I report things like an Internal error ? Thanks, -- Olivier Mascia
Jul 30 2003
Yet another bug, this one produces a crash of the compiler. There is a workaround though. Walter, see the attached small test code demonstrating it. -- Olivier Mascia
Jul 30 2003
Olivier Mascia wrote:Should I better use the stl provided with dmc or add STLport ?Answering to myself: trying to compile any *serious* code with the STL as provided in the stl directory of DMC 8.34 is a good way to loose time. :) Solution is to install the STLport version from the digitalmars.com website and correctly tune the bin/sc.ini file so that the stlport/stlport comes first (before other include directories). Also removing the other stl directory from this list of includes is not a bad idea. I could go as well as to remove the stl directory altogether ! :) Even with this there are still some quirks regarding apparently complex namespace handling. One of them can crash the compiler. See other posts. But can be worked-around. Having bombed this group with lots of questions and answers to myself over the last hours, I think a bit of explanation on what I was trying to achieve will be welcome. The piece of code which I was trying to compile with DMC is IBPP <http://www.ibpp.org>. This is a class library to access Firebird database server <http://www.firebirdsql.org> through its C-API much more easily than at the C level. Now with some work-arounds, the library does build correctly as well as its test programs, which run flawlessly. The next release of IBPP (2.2) will have DigitalMars Compiler listed as one of its supported compilers on Win32. -- Olivier Mascia
Jul 30 2003
"Olivier Mascia" <om-removethis tipgroup.com> wrote in message news:bg8jp4$1ctr$1 digitaldaemon.com...Olivier Mascia wrote::)Should I better use the stl provided with dmc or add STLport ?Answering to myself: trying to compile any *serious* code with the STL as provided in the stl directory of DMC 8.34 is a good way to loose time.Solution is to install the STLport version from the digitalmars.com website and correctly tune the bin/sc.ini file so that the stlport/stlport comes first (before other include directories). Also removing the other stl directory from this list of includes is not a bad idea. I could go as well as to remove the stl directory altogether ! :) Even with this there are still some quirks regarding apparently complex namespace handling. One of them can crash the compiler. See other posts. But can be worked-around. Having bombed this group with lots of questions and answers to myself over the last hours, I think a bit of explanation on what I was trying to achieve will be welcome. The piece of code which I was trying to compile with DMC is IBPP <http://www.ibpp.org>. This is a class library to access Firebird database server <http://www.firebirdsql.org> through its C-API much more easily than at the C level. Now with some work-arounds, the library does build correctly as well as its test programs, which run flawlessly. The next release of IBPP (2.2) will have DigitalMars Compiler listed as one of its supported compilers on Win32.Great! Let me know when the release happens, with links to it, so I can list it as compatible with DMC++. -Walter
Jul 30 2003
You can include the STLSoft root header stlsoft.h, and qualify with stlsoft_ns_using_std() or stlsoft_ns_qual_std(), as in #include <string> int main(int, char*[]) { stlsoft_ns_qual_std(string) a; stlsoft_ns_qual_std(string) b; .. } or #include <string> int main(int, char*[]) { stlsoft_ns_using_std(string) string a; string b; .. } or #include <string> int main(int, char*[]) { typedef stlsoft_ns_qual_std(string) string_t; string_t a; string_t b; .. } It's ugly (it's supposed to be!), but it is eminently portable between all the STLSoft supported compilers (http://stlsoft.org/compilers.html) "Olivier Mascia" <Olivier_member pathlink.com> wrote in message news:bg6snj$2l81$1 digitaldaemon.com...In article <a3qqj5$250g$1 digitaldaemon.com>, Walter says...prefixTaking into account the large number of programs using STL through std::the DM compiler does not define __STL_HAS_NAMESPACESDMC++ supports namespaces as of the ARM, but not as of the latest STL. It will eventually support it, but not yet. Sorry. -Waltera bit everywhere like in the following : #include <string> int main(int, char*[]) { std::string a; .. } doesn't this look like a very *serious* limitation ? Short of editing thousands of 'std::' prefixes how would you recommendportingexisting code using STL to DMC ? Thanks for suggestions, -- Olivier Mascia
Jul 29 2003