Connecting Tech Pros Worldwide Help | Site Map

string vs. String

  #1  
Old July 19th, 2005, 06:28 PM
Agent Mulder
Guest
 
Posts: n/a
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


  #2  
Old July 19th, 2005, 06:28 PM
Gianni Mariani
Guest
 
Posts: n/a

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.

  #3  
Old July 19th, 2005, 06:28 PM
shakahshakah@yahoo.com
Guest
 
Posts: n/a

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]
  #4  
Old July 19th, 2005, 06:28 PM
Agent Mulder
Guest
 
Posts: n/a

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


  #5  
Old July 19th, 2005, 06:28 PM
Aggro
Guest
 
Posts: n/a

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

  #6  
Old July 19th, 2005, 06:29 PM
Jon Bell
Guest
 
Posts: n/a

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
  #7  
Old July 19th, 2005, 06:30 PM
Chris Theis
Guest
 
Posts: n/a

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


  #8  
Old July 19th, 2005, 06:30 PM
Kevin Goodsell
Guest
 
Posts: n/a

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.

  #9  
Old July 19th, 2005, 06:32 PM
Chris Theis
Guest
 
Posts: n/a

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


  #10  
Old July 19th, 2005, 06:33 PM
jeffc
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
String vs StringBuilder Chizl answers 1 February 4th, 2008 04:15 PM
String vs Numeric Type (2) Brian Tkatch answers 2 January 25th, 2006 02:55 PM
StringBuilder Performance vs. String Concatenation Kevin C answers 38 November 22nd, 2005 06:06 AM
String vs new String Grant Wagner answers 8 July 23rd, 2005 09:27 PM
StringBuilder Performance vs. String Concatenation Kevin C answers 37 July 21st, 2005 11:18 AM