string vs. String

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Agent Mulder

    string vs. String

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

    #include<iostre am>
    #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

    #2
    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<iostre am>
    > #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.

    Comment

    • shakahshakah@yahoo.com

      #3
      Re: string vs. String

      Does your "funky new compiler" understand the following?

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

      In article <bjvic3$tga$1@n ews2.tilbu1.nb. home.nl>, "Agent Mulder"
      <mbmulder_remov e_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<iostr eam>
      >#include<strin g>
      >int main()
      >{
      >String a="Hello World";
      >cout<<a<<end l;
      >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]

      Comment

      • Agent Mulder

        #4
        Re: string vs. String

        <shakahshakah >[color=blue]
        > Does your "funky new compiler" understand the following?
        >
        > #include<iostre am>
        > #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


        Comment

        • Aggro

          #5
          Re: string vs. String

          Agent Mulder wrote:[color=blue]
          > <shakahshakah >
          >[color=green]
          >>Does your "funky new compiler" understand the following?
          >>
          >>#include<iost ream>
          >>#include<stri ng>
          >>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<iostre am>
          #include<string >
          using namespace std;

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

          Comment

          • Jon Bell

            #6
            Re: string vs. String

            In article <bjvp53$bgj$1@n ews2.tilbu1.nb. home.nl>,
            Agent Mulder <mbmulder_remov e_this_@home.nl > wrote:[color=blue]
            ><shakahshaka h>[color=green]
            >> Does your "funky new compiler" understand the following?
            >>
            >> #include<iostre am>
            >> #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@pres by.edu> Presbyterian College
            Dept. of Physics and Computer Science Clinton, South Carolina USA

            Comment

            • Chris Theis

              #7
              Re: string vs. String


              "Agent Mulder" <mbmulder_remov e_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:

              Aktuelle News aus Politik, Sport, Unterhaltung, Wirtschaft & Finanzen | Ratgeber Leben, Gesundheit und Heim & Garten | E-Mail und Shopping bei t-online.


              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


              Comment

              • Kevin Goodsell

                #8
                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.

                Comment

                • Chris Theis

                  #9
                  Re: string vs. String


                  "Kevin Goodsell" <usenet1.spamfr ee.fusion@never box.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


                  Comment

                  • jeffc

                    #10
                    Re: string vs. String


                    "Agent Mulder" <mbmulder_remov e_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<iostre am>
                    > #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.


                    Comment

                    Working...