string vs. String

A

Agent Mulder

My funky new compiler does not understand
string, but it does understand String, so that this
program gives the expected result:

#include<iostream>
#include<string>
int main()
{
String a="Hello World";
cout<<a<<endl;
return 0;
}

Is this a pecularity that I can ignore or is String
different from string? Can I apply iterators on it?
How portable is it. Does anybody familiar with
the system (Open Watcom) know if and how I
can obtain the usual std::string?

-X
 
G

Gianni Mariani

Agent said:
My funky new compiler does not understand
string, but it does understand String, so that this
program gives the expected result:

#include<iostream>
#include<string>
int main()
{
String a="Hello World";
cout<<a<<endl;
return 0;
}

Compiling this code on gcc 3.3.1 I get:

error: `String' undeclared (first use this function)
Is this a pecularity that I can ignore or is String
different from string? Can I apply iterators on it?
How portable is it. Does anybody familiar with
the system (Open Watcom) know if and how I
can obtain the usual std::string?

I believe it it non-conforming to standard C++. Use std::string.
 
S

shakahshakah

Does your "funky new compiler" understand the following?

#include<iostream>
#include<string>
int main()
{
std::string a="Hello World";
std::cout << a << std::endl;
return 0;
}
 
A

Agent Mulder

Does your "funky new compiler" understand the following?

#include<iostream>
#include<string>
int main()
{
std::string a="Hello World";
std::cout << a << std::endl;
return 0;
}
</shakahshakah>

No, it does not. std is viewed as a 'class' and not found.
No vector, map, list, anything. Thumbs go down. Hopefully
I can path it with STLport because the environment of
Open Watcom is cool but having no STL is not cool at all.

-X
 
A

Aggro

Agent said:
</shakahshakah>

No, it does not. std is viewed as a 'class' and not found.
No vector, map, list, anything. Thumbs go down. Hopefully
I can path it with STLport because the environment of
Open Watcom is cool but having no STL is not cool at all.

How about this:

#include<iostream>
#include<string>
using namespace std;

int main()
{
string a="Hello World";
cout << a << endl;
return 0;
}
 
J

Jon Bell

</shakahshakah>

No, it does not. std is viewed as a 'class' and not found.

Then your funky new compiler is either a very old outdated compiler or a
badly installed or otherwise broken new compiler.
 
C

Chris Theis

Agent Mulder said:
No, it does not. std is viewed as a 'class' and not found.
No vector, map, list, anything. Thumbs go down. Hopefully
I can path it with STLport because the environment of
Open Watcom is cool but having no STL is not cool at all.

I guess it might be worth to check out the following site to help your
obviously not so "funky" compiler to get going:

http://home.t-online.de/home/howlingmad/watcom_stl_en.html

IMHO one should really consider whether it's a good idea to use a compiler
which does not even support the basic standard library classes like string.

Regards
Chris
 
K

Kevin Goodsell

Chris said:
I guess it might be worth to check out the following site to help your
obviously not so "funky" compiler to get going:

http://home.t-online.de/home/howlingmad/watcom_stl_en.html

IMHO one should really consider whether it's a good idea to use a compiler
which does not even support the basic standard library classes like string.

I don't know what the difference is, but he's using Open Watcom. I
notice, for one thing, that Open Watcom is on version 1.1, while that
site is talking about Watcom 11.0c. I don't know anything about either,
but it looks like Watcom was discontinued then the source was opened and
after some work Open Watcom was released based on that source. 11.0c was
apparently a patch to the last official version(?) of Watcom, and came
out before(?) Open Watcom 1.0.

So my point is that the site linked above seems to be about an earlier
version than the OP is probably using, and might not be completely up to
date for his version.

-Kevin
 
C

Chris Theis

[SNIP]>
I don't know what the difference is, but he's using Open Watcom. I
notice, for one thing, that Open Watcom is on version 1.1, while that
site is talking about Watcom 11.0c. I don't know anything about either,
but it looks like Watcom was discontinued then the source was opened and
after some work Open Watcom was released based on that source. 11.0c was
apparently a patch to the last official version(?) of Watcom, and came
out before(?) Open Watcom 1.0.

So my point is that the site linked above seems to be about an earlier
version than the OP is probably using, and might not be completely up to
date for his version.

-Kevin
--

Hi Kevin,

you're of course right. The thing is that this links actually came from a
site which was dealing with Open Watcom, although it's in German and that's
why I didn't mention it here in an English newsgroup. Anyway I probably
should have given the full reference.

Regards
Chris
 
J

jeffc

Agent Mulder said:
My funky new compiler does not understand
string, but it does understand String, so that this
program gives the expected result:

#include<iostream>
#include<string>
int main()
{
String a="Hello World";
cout<<a<<endl;
return 0;
}

Is this a pecularity that I can ignore or is String
different from string?

String is different from string. I have no idea what String is. It's not
standard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top