To STL or not to STL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Allan Bruce

    To STL or not to STL

    Hi there,

    I am interested to know if there are any C++ programmers who do not use STL.
    I have been coding in C++ for a year or so now, although only recently have
    I started a large(ish)-scale project. I do not use any STL, and I was
    wondering if there are any others out there that program in C++ without
    using STL? (Just to see if I am being stupid by not using it)

    Thanks
    Allan

    --
    Allan Bruce
    Dept. of Computing Science
    University of Aberdeen
    Aberdeen AB24 3UE
    Scotland, UK


  • André Pönitz

    #2
    Re: To STL or not to STL

    Allan Bruce <allanmb@takeaw ayf2s.com> wrote:[color=blue]
    > I am interested to know if there are any C++ programmers who do not use STL.[/color]

    Can't speeak for the others by I certainly do not build all the general
    purpose containers myself. Why should I?

    Andre'

    Comment

    • Christopher Benson-Manica

      #3
      Re: To STL or not to STL

      Allan Bruce <allanmb@takeaw ayf2s.com> spoke thus:
      [color=blue]
      > I am interested to know if there are any C++ programmers who do not use STL.
      > I have been coding in C++ for a year or so now, although only recently have
      > I started a large(ish)-scale project. I do not use any STL, and I was
      > wondering if there are any others out there that program in C++ without
      > using STL? (Just to see if I am being stupid by not using it)[/color]

      FWIW, the director of programming at my company is an old DOS h4x0r, and he
      long ago wrote code that completely wraps/replaces (I can't say which...) the
      STL. His reasoning is that the STL (std::vectors, particularly), didn't
      behave like he wanted, and anyway he's a real "reinvent a better wheel" type
      of guy.

      --
      Christopher Benson-Manica | I *should* know what I'm talking about - if I
      ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

      Comment

      • Graeme Cogger

        #4
        Re: To STL or not to STL

        Allan Bruce wrote:[color=blue]
        >
        > Hi there,
        >
        > I am interested to know if there are any C++ programmers who do not use STL.
        > I have been coding in C++ for a year or so now, although only recently have
        > I started a large(ish)-scale project. I do not use any STL, and I was
        > wondering if there are any others out there that program in C++ without
        > using STL? (Just to see if I am being stupid by not using it)
        >
        > Thanks
        > Allan
        >[/color]
        I'd say that the biggest group of programmers that don't use the
        standard library would have to be those writing Windows apps using the
        MFC library. Since MFC provides similar types of classes (strings,
        containers), the majority of programmers that I know have little
        knowledge of the standard library.

        Comment

        • d2003xx

          #5
          Re: To STL or not to STL

          "Allan Bruce" <allanmb@TAKEAW AYf2s.com> wrote in message news:<bmlqta$4g b$1@news.freedo m2surf.net>...[color=blue]
          > Hi there,
          >
          > I am interested to know if there are any C++ programmers who do not use STL.
          > I have been coding in C++ for a year or so now, although only recently have
          > I started a large(ish)-scale project. I do not use any STL, and I was
          > wondering if there are any others out there that program in C++ without
          > using STL? (Just to see if I am being stupid by not using it)[/color]

          me. Because it slows down the compilation too much (I hate waiting..)

          Comment

          • Ron Natalie

            #6
            Re: To STL or not to STL


            "Allan Bruce" <allanmb@TAKEAW AYf2s.com> wrote in message news:bmlqta$4gb $1@news.freedom 2surf.net...[color=blue]
            > Hi there,
            >
            > I am interested to know if there are any C++ programmers who do not use STL.[/color]

            I'm assuming by STL we're talking about the standard C++ library (as opposed to
            the old thing called the STL which precedes it).

            If they never use it, they've got their head stuck some where.
            [color=blue]
            > I have been coding in C++ for a year or so now, although only recently have
            > I started a large(ish)-scale project. I do not use any STL, and I was
            > wondering if there are any others out there that program in C++ without
            > using STL? (Just to see if I am being stupid by not using it)
            >[/color]
            Yes you are. If there is a feature supported by the library, you're better
            off using it than rolling your own. They make things much simpler. For
            example, vector and string both have reasonable copy/assignment/destruction
            behavior which means you don't have to sit there managing memory with new and
            delete.


            Comment

            • Ron Natalie

              #7
              Re: To STL or not to STL


              "Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message news:bmm46e$grp $3@chessie.cirr .com...
              [color=blue]
              > behave like he wanted, and anyway he's a real "reinvent a better wheel" type[/color]

              What makes you think his reinvented wheel is better?
              ..


              Comment

              • Ron Natalie

                #8
                Re: To STL or not to STL


                "Graeme Cogger" <graeme.coggerS PAMLESS@baesyst ems.com> wrote in message news:3F8E9AD7.8 E13785E@baesyst ems.com...
                [color=blue]
                > I'd say that the biggest group of programmers that don't use the
                > standard library would have to be those writing Windows apps using the
                > MFC library. Since MFC provides similar types of classes (strings,
                > containers), the majority of programmers that I know have little
                > knowledge of the standard library.[/color]

                The majority of people who think the world ends at the MFC boundary
                perhaps. I wouldn't say a majority of C++ programmers.


                Comment

                • Christopher Benson-Manica

                  #9
                  Re: To STL or not to STL

                  Ron Natalie <ron@sensor.com > spoke thus:
                  [color=blue]
                  > What makes you think his reinvented wheel is better?[/color]

                  Nothing, necessarily. His philosophy is that he'd rather debug his own code
                  rather than someone else's. I think the main reason we don't use the STL is
                  that he started writing code 20 years ago, and back then I imagine his code
                  may very well have been superior to the STL. One advantage is that when I
                  want a "standard" class to do something different, I've got the implementor of
                  the class sitting two desks away, and in 10 minutes I have what I want. The
                  disadvantage, of course, is that should I find employment elsewhere, my new
                  boss probably will not be pleased that I know nothing about the standard
                  template library.

                  --
                  Christopher Benson-Manica | I *should* know what I'm talking about - if I
                  ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

                  Comment

                  • Ron Natalie

                    #10
                    Re: To STL or not to STL


                    "Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message news:bmmm1c$iet $2@chessie.cirr .com...[color=blue]
                    > Ron Natalie <ron@sensor.com > spoke thus:
                    >[color=green]
                    > > What makes you think his reinvented wheel is better?[/color]
                    >
                    > Nothing, necessarily. His philosophy is that he'd rather debug his own code
                    > rather than someone else's.[/color]

                    My philosophy is that the standard library is usually already debugged. Certainly
                    any bugs in it are much easier to deal with than reimplementing it and debugging
                    and providing ongoing support for an equivelent amout of code.
                    [color=blue]
                    > I think the main reason we don't use the STL is
                    > that he started writing code 20 years ago, and back then I imagine his code
                    > may very well have been superior to the STL.[/color]

                    That is true. C++ wasn't really usable more than about 10 years ago. I've been
                    programming in C since 1977. Times change. He needs to shed his antiquated
                    belief systems. Many people who transition to C++ suffer from this brain damage.
                    [color=blue]
                    > The
                    > disadvantage, of course, is that should I find employment elsewhere, my new
                    > boss probably will not be pleased that I know nothing about the standard
                    > template library.[/color]

                    Absolutely, you'd have extreme difficulty with an interview here.


                    Comment

                    • Mike Wahler

                      #11
                      Re: To STL or not to STL


                      "Ron Natalie" <ron@sensor.com > wrote in message
                      news:3f8ec2de$0 $69313$9a6e19ea @news.newshosti ng.com...[color=blue]
                      >
                      > "Graeme Cogger" <graeme.coggerS PAMLESS@baesyst ems.com> wrote in message[/color]
                      news:3F8E9AD7.8 E13785E@baesyst ems.com...[color=blue]
                      >[color=green]
                      > > I'd say that the biggest group of programmers that don't use the
                      > > standard library would have to be those writing Windows apps using the
                      > > MFC library. Since MFC provides similar types of classes (strings,
                      > > containers), the majority of programmers that I know have little
                      > > knowledge of the standard library.[/color]
                      >
                      > The majority of people who think the world ends at the MFC boundary
                      > perhaps. I wouldn't say a majority of C++ programmers.[/color]

                      I write quite a bit of Windows code myself, at first it was
                      only in C, but now moreso in C++. Guess what I use for string
                      handling, containers, and much of the i/o? Standard Library.
                      MFC? Ten-foot-pole, and all that. :-)

                      -Mike


                      Comment

                      • Mike Wahler

                        #12
                        Re: To STL or not to STL

                        "Ron Natalie" <ron@sensor.com > wrote in message
                        news:3f8ec298$0 $69369$9a6e19ea @news.newshosti ng.com...[color=blue]
                        >
                        > "Allan Bruce" <allanmb@TAKEAW AYf2s.com> wrote in message[/color]
                        news:bmlqta$4gb $1@news.freedom 2surf.net...[color=blue][color=green]
                        > > Hi there,
                        > >
                        > > I am interested to know if there are any C++ programmers who do not use[/color][/color]
                        STL.[color=blue]
                        >
                        > I'm assuming by STL we're talking about the standard C++ library (as[/color]
                        opposed to[color=blue]
                        > the old thing called the STL which precedes it).
                        >
                        > If they never use it, they've got their head stuck some where.
                        >[color=green]
                        > > I have been coding in C++ for a year or so now, although only recently[/color][/color]
                        have[color=blue][color=green]
                        > > I started a large(ish)-scale project. I do not use any STL, and I was
                        > > wondering if there are any others out there that program in C++ without
                        > > using STL? (Just to see if I am being stupid by not using it)
                        > >[/color]
                        > Yes you are. If there is a feature supported by the library, you're[/color]
                        better[color=blue]
                        > off using it than rolling your own. They make things much simpler. For
                        > example, vector and string both have reasonable[/color]
                        copy/assignment/destruction[color=blue]
                        > behavior which means you don't have to sit there managing memory with new[/color]
                        and[color=blue]
                        > delete.[/color]

                        Also IMO equally important, not only is the code portable to
                        other platforms without all the 'hand rolled' baggage, but it's
                        also 'comprehension portable'. Any good C++ programmer recognizes
                        e.g. std::vector<std ::string> as quickly and readily as he does
                        e.g. a 'for' loop.

                        One might compare this concept with e.g. the consistent sizes,
                        shapes, and colors of various types of road signs as in the
                        U.S., IMO a Good Thing(tm). "Everybody knows what they mean."

                        Who needs to pause to actually *read* the word "stop" on a
                        stop-sign? A red and white octagon at an intersection immediately
                        conveys the message, allowing one to focus on other important
                        things, such as keeping an eye on that child on a bicycle riding
                        on the shoulder.

                        Those little rascals are just like program bugs, they'll dart
                        out in front of you with no warning. (Happened to me this morning,
                        that's what evoked the analogy.) Other than being a bit rattled
                        by the tire screech and my scolding, he's OK. :-)

                        -Mike


                        Comment

                        • Karl Heinz Buchegger

                          #13
                          Re: To STL or not to STL



                          Mike Wahler wrote:[color=blue]
                          >
                          >
                          > Also IMO equally important, not only is the code portable to
                          > other platforms without all the 'hand rolled' baggage, but it's
                          > also 'comprehension portable'. Any good C++ programmer recognizes
                          > e.g. std::vector<std ::string> as quickly and readily as he does
                          > e.g. a 'for' loop.
                          >
                          > One might compare this concept with e.g. the consistent sizes,
                          > shapes, and colors of various types of road signs as in the
                          > U.S., IMO a Good Thing(tm). "Everybody knows what they mean."
                          >[/color]

                          Aaahhhh. You mean the white "PED XING" painted on the street :-)
                          I had quite a funny time figuring out what that could mean when
                          visiting the US the first time. (Keep in mind: I am not a native
                          english speaker)

                          --
                          Karl Heinz Buchegger
                          kbuchegg@gascad .at

                          Comment

                          • lilburne

                            #14
                            Re: To STL or not to STL

                            Allan Bruce wrote:[color=blue]
                            > Hi there,
                            >
                            > I am interested to know if there are any C++ programmers who do not use STL.
                            > I have been coding in C++ for a year or so now, although only recently have
                            > I started a large(ish)-scale project. I do not use any STL, and I was
                            > wondering if there are any others out there that program in C++ without
                            > using STL? (Just to see if I am being stupid by not using it)
                            >[/color]

                            We don't use the standard library. Because when the decision
                            to move to C++ was made in 1990 the standard library didn't
                            exist. Most compilers didn't support templates, and as they
                            became available they was buggy, poorly implemented and non
                            standard across different platforms. Basically you couldn't
                            write a portable system that used templates.

                            Lists, sets, vectors, maps, strings, smart pointers etc were
                            developed in-house using the generic macros that were the
                            forerunners to templates. By the time the standard library
                            was stable enough to use, we had our own variants that had
                            been used throughout the company for a number of years.

                            If we were starting out today then we would use the standard
                            library, but currently there is no incentive to use the
                            standard library when our own variant already does the job.

                            Comment

                            • puppet_sock@hotmail.com

                              #15
                              Re: To STL or not to STL

                              "Allan Bruce" <allanmb@TAKEAW AYf2s.com> wrote in message news:<bmlqta$4g b$1@news.freedo m2surf.net>...
                              [to STL or not as the subject says]

                              Think of it this way:
                              - The STL is available to anybody with a recent C++ compiler.
                              - The STL is far more likely to be transportable than any code
                              you write to replace it.
                              - The STL is documented in several very good texts.
                              - The previous includes how to make the STL peform efficiently
                              in very many common situations and applications.
                              - Also included is how to choose the right container for the job.
                              - Also included are many considerations on how to avoid trouble,
                              what contained objects are required to do or provide, how to
                              debug trouble, how to instrument things to see how things are
                              doing, how to prevent resource leaks, etc. etc.
                              - There are several good places to discuss the STL with experts,
                              one such place being here.
                              - There is an absolute boatload of available examples in STL.
                              - There are many experienced STL users. New team members are likely
                              to already be experienced with STL.
                              - There are web sites that compare compilers based on, among other
                              things, how well they implement the STL.
                              - Learning the STL, and learning it well, is likely to make you a
                              more attractive member of future development teams.

                              So, if you hack together some cobbled kludge to replace the STL:
                              - You won't find any examples.
                              - You will have to provide your own documentation.
                              - You won't get much help from experts.
                              - If you want to hire somebody to help on your project, you will
                              have to train them up in your hacked kludge.
                              - If it runs slowly, you won't get help on making it faster.
                              - If you have memory leaks, space issues, etc., there won't be
                              any articles in magazines to help you.
                              - Your experience with this hack is unlikely to make you a more
                              attractive member of future software development teams.

                              In other words, this is one of those cases where standardization
                              is a very good thing. As somebody else said, the only reason not
                              to use the STL would be if you were handed an existing library
                              that provided all the functionality you needed. For example,
                              MFC based apps might not use the STL. Though I usually do anyway,
                              on those occasions I write an MFC app.
                              Socks

                              Comment

                              Working...