Connecting Tech Pros Worldwide Help | Site Map

string vs. String

Agent Mulder
Guest
 
Posts: n/a
#1: Jul 19 '05
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


Gianni Mariani
Guest
 
Posts: n/a
#2: Jul 19 '05

re: string vs. String


Agent Mulder wrote:[color=blue]
> 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;
> }[/color]

Compiling this code on gcc 3.3.1 I get:

error: `String' undeclared (first use this function)
[color=blue]
>
> 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?[/color]

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

shakahshakah@yahoo.com
Guest
 
Posts: n/a
#3: Jul 19 '05

re: string vs. String


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;
}

In article <bjvic3$tga$1@news2.tilbu1.nb.home.nl>, "Agent Mulder"
<mbmulder_remove_this_@home.nl> wrote:[color=blue]
>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
>
>[/color]
Agent Mulder
Guest
 
Posts: n/a
#4: Jul 19 '05

re: string vs. String


<shakahshakah>[color=blue]
> 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;
> }[/color]
</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


Aggro
Guest
 
Posts: n/a
#5: Jul 19 '05

re: string vs. String


Agent Mulder wrote:[color=blue]
> <shakahshakah>
>[color=green]
>>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;
>>}[/color]
>
> </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.[/color]

How about this:

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

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

Jon Bell
Guest
 
Posts: n/a
#6: Jul 19 '05

re: string vs. String


In article <bjvp53$bgj$1@news2.tilbu1.nb.home.nl>,
Agent Mulder <mbmulder_remove_this_@home.nl> wrote:[color=blue]
><shakahshakah>[color=green]
>> 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;
>> }[/color]
></shakahshakah>
>
>No, it does not. std is viewed as a 'class' and not found.[/color]

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

--
Jon Bell <jtbellap8@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
Chris Theis
Guest
 
Posts: n/a
#7: Jul 19 '05

re: string vs. String



"Agent Mulder" <mbmulder_remove_this_@home.nl> wrote in message
news:bjvp53$bgj$1@news2.tilbu1.nb.home.nl...[color=blue]
>
> 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.
>[/color]

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/howling...om_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


Kevin Goodsell
Guest
 
Posts: n/a
#8: Jul 19 '05

re: string vs. String


Chris Theis wrote:
[color=blue]
>
> 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/howling...om_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.
>[/color]

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
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Chris Theis
Guest
 
Posts: n/a
#9: Jul 19 '05

re: string vs. String



"Kevin Goodsell" <usenet1.spamfree.fusion@neverbox.com> wrote in message
news:Ci39b.3430
[SNIP]>[color=blue]
> 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
> --[/color]

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


jeffc
Guest
 
Posts: n/a
#10: Jul 19 '05

re: string vs. String



"Agent Mulder" <mbmulder_remove_this_@home.nl> wrote in message
news:bjvic3$tga$1@news2.tilbu1.nb.home.nl...[color=blue]
> 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?[/color]

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


Closed Thread