October 04, 2001

John Fletcher wrote:

> Walter wrote:
>
> > Here's an experimental compiler for compiling the full STL 3.3 from SGI.
> >
> > www.digitalmars.com/dmc/dmcppDownload.html
>
> I did some tests on this last night.  The STL doesn't come with a <string> definition so lots of my examples won't work. Is there one available for this?
>
> John

Sorry, problem solved using a complete set of SGI STL 3.3 and then putting yours on top.

Cheers

John


October 04, 2001
With some further testing I am finding a problem which I also found with SGI STL 3.20 previously.

Consider the following function returning a string:

string Name(string a) {
    return a;
}

The conditional code assignment fails when the boolean value is false:
    bool test;
    string a = "a";
    test = false;
    // This fails for false and returns garbage in the string.
    string s = test ? "true" : Name(a).c_str();
    // This works for false.
    string s2 = test ? Name(a).c_str() : Name(a).c_str();
    // This works
    s = test ? string("true") : Name(a);
    // This works
    string t = test ? "true" : a.c_str    // This works
    string u;
    if (test) u = "true"; else u = Name(a).c_str();

I also need to define this to get termination of the strings:

#define __STL_DEFAULT_CONSTRUCTOR_BUG

Cheers

John


October 04, 2001

John Fletcher wrote:

> With some further testing I am finding a problem which I also found with SGI STL 3.20 previously.
>
> Consider the following function returning a string:
>
> string Name(string a) {
>     return a;
> }
>
> The conditional code assignment fails when the boolean value is false:
>     bool test;
>     string a = "a";
>     test = false;
>     // This fails for false and returns garbage in the string.
>     string s = test ? "true" : Name(a).c_str();
>     // This works for false.
>     string s2 = test ? Name(a).c_str() : Name(a).c_str();
>     // This works
>     s = test ? string("true") : Name(a);
>     // This works
>     string t = test ? "true" : a.c_str    // This works

Correction, the previous line should be:
string t = test ? "true" : a.c_str();
// This works

>
>     string u;
>     if (test) u = "true"; else u = Name(a).c_str();
>
> I also need to define this to get termination of the strings:
>
> #define __STL_DEFAULT_CONSTRUCTOR_BUG
>
> Cheers
>
> John

I had better append a complete program file.

John



October 04, 2001
John Fletcher wrote in message <3BBC3F1B.EC73345C@aston.ac.uk>...
>Walter wrote:
>> Here's an experimental compiler for compiling the full STL 3.3 from SGI.
>>
>> www.digitalmars.com/dmc/dmcppDownload.html
>I did some tests on this last night.  The STL doesn't come with a <string> definition so lots of my examples won't work. Is there one available for this?


Oops. The files with no extension didn't make it into the zip file. I fixed it, try downloading it again.


October 04, 2001
"John Fletcher" <J.P.Fletcher@aston.ac.uk> wrote in message news:3BBC70E8.85314DDE@aston.ac.uk...
> I also need to define this to get termination of the strings:
>
> #define __STL_DEFAULT_CONSTRUCTOR_BUG


I'd like a (small) test case demonstrating this is needed. Thanks!


October 05, 2001

Walter wrote:

> "John Fletcher" <J.P.Fletcher@aston.ac.uk> wrote in message news:3BBC70E8.85314DDE@aston.ac.uk...
> > I also need to define this to get termination of the strings:
> >
> > #define __STL_DEFAULT_CONSTRUCTOR_BUG
>
> I'd like a (small) test case demonstrating this is needed. Thanks!

I'll try again with your latest distribution.  If there is still a problem I'll do an example.

John


October 05, 2001

Walter wrote:

> "John Fletcher" <J.P.Fletcher@aston.ac.uk> wrote in message news:3BBC70E8.85314DDE@aston.ac.uk...
> > I also need to define this to get termination of the strings:
> >
> > #define __STL_DEFAULT_CONSTRUCTOR_BUG
>
> I'd like a (small) test case demonstrating this is needed. Thanks!

Walter

Here is a small case which gives different output with and without the define. The outputs I get are in a comment in the program.  Compilation in the directory with the SGI 3.3 is   sc -I. onestr.cpp.

John



October 05, 2001
thanks!

"John Fletcher" <J.P.Fletcher@aston.ac.uk> wrote in message news:3BBD9F8A.EBE21BF7@aston.ac.uk...
>
>
> Walter wrote:
>
> > "John Fletcher" <J.P.Fletcher@aston.ac.uk> wrote in message news:3BBC70E8.85314DDE@aston.ac.uk...
> > > I also need to define this to get termination of the strings:
> > >
> > > #define __STL_DEFAULT_CONSTRUCTOR_BUG
> >
> > I'd like a (small) test case demonstrating this is needed. Thanks!
>
> Walter
>
> Here is a small case which gives different output with and without the define. The outputs I get are in a comment in the program.  Compilation in the directory with the SGI 3.3 is   sc -I. onestr.cpp.
>
> John
>
>


1 2
Next ›   Last »