C++: auto_ptr, binders deprecated

Discussion in 'C Programming' started by lovecreatesbea...@gmail.com, Jul 8, 2010.

  1. Guest

    the 2010, 03 draft std of C++ states that

    auto_ptr deprecated, use shared_ptr (boost?) instead; binders:
    bind1st, bind2nd, .. deprecated, use bind instead.

    were there features in C abandoned so soon like that in C++? those C++
    features dismissed even before many programmers didn't have a single
    try. the author said, the things you didnt know about C++ wont hurt yo.
     
    , Jul 8, 2010
    #1
    1. Advertising

  2. On Jul 8, 10:24 am, ""
    <> wrote:
    > the 2010, 03 draft std of C++ states that
    >
    > auto_ptr deprecated, use shared_ptr (boost?) instead; binders:
    > bind1st, bind2nd, .. deprecated, use bind instead.
    >
    > were there features in C abandoned so soon like that in C++? those C++
    > features dismissed even before many programmers didn't have a single
    > try. the author said, the things you didnt know about C++ wont hurt yo.


    gets was just like that. They gave it to us and BOOM, they took it
    away. Those evil standards folks.

    :) if you are humor impaired. C has been pretty stable for quite some
    time, some see that as bad, some as a feature.
     
    David Resnick, Jul 8, 2010
    #2
    1. Advertising

  3. On 8 July, 15:40, David Resnick <> wrote:
    > On Jul 8, 10:24 am, ""
    > <> wrote:



    > > the 2010, 03 draft std of C++ states that

    >
    > > auto_ptr deprecated, use shared_ptr (boost?) instead; binders:
    > > bind1st, bind2nd, .. deprecated, use bind instead.

    >
    > > were there features in C abandoned so soon like that in C++? those C++
    > > features dismissed even before many programmers didn't have a single
    > > try. the author said, the things you didnt know about C++ wont hurt yo.


    auto_ptr has been around a long time! At one time I gave up on C++ as
    it seemed to change every 5 minutes.

    > gets was just like that.  They gave it to us and BOOM, they took it
    > away.  Those evil standards folks.
    >
    > :) if you are humor impaired.  C has been pretty stable for quite some
    > time, some see that as bad, some as a feature.


    "auto" keyword is almost useless
    did early C have "fortran" and "entry" keywords or was that just a
    rumour?
     
    Nick Keighley, Jul 8, 2010
    #3
  4. Nick Keighley <> writes:
    [...]
    > "auto" keyword is almost useless


    Which is why C++ is re-using it for a new purpose.

    > did early C have "fortran" and "entry" keywords or was that just a
    > rumour?


    K&R1, Appendix A, 2.3:

    The entry keyword is not currently implemented by any compiler
    but is reserved for future use. Some implementations also
    reserve the words fortran and asm.

    K&R2 mentions "fortran" and "asm".

    Both C90 and C99 mention the "fortran" and "asm" keywords under
    "Common extensions"; neither mentions "entry".

    I think the original intent of "entry" was to permit alternative entry
    points to be defined for functions, making it easier, for example, to
    define sin() and cos() as a single function. Fortran has such a
    feature.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jul 8, 2010
    #4
  5. Nick Guest

    "" <> writes:

    > the 2010, 03 draft std of C++ states that
    >
    > auto_ptr deprecated, use shared_ptr (boost?) instead; binders:
    > bind1st, bind2nd, .. deprecated, use bind instead.
    >
    > were there features in C abandoned so soon like that in C++? those C++
    > features dismissed even before many programmers didn't have a single
    > try. the author said, the things you didnt know about C++ wont hurt yo.


    Trigraphs (says he who used some of them once)?
    --
    Online waterways route planner | http://canalplan.eu
    Plan trips, see photos, check facilities | http://canalplan.org.uk
     
    Nick, Jul 9, 2010
    #5
  6. Nick <> writes:
    > "" <> writes:
    >> the 2010, 03 draft std of C++ states that
    >>
    >> auto_ptr deprecated, use shared_ptr (boost?) instead; binders:
    >> bind1st, bind2nd, .. deprecated, use bind instead.
    >>
    >> were there features in C abandoned so soon like that in C++? those C++
    >> features dismissed even before many programmers didn't have a single
    >> try. the author said, the things you didnt know about C++ wont hurt yo.

    >
    > Trigraphs (says he who used some of them once)?


    Trigraphs are rarely used, but they've never been officially
    deprecated. (And I understand that there are still environments
    where there necessary and actually used.)

    I'd have preferred a solution that can be completely ignored when
    it's not needed, e.g., disabling trigraphs unless a specific #pragma
    appears at the top of the source file. Figuring out how to spell
    "#pragma" without trigraphs is a bit of an obstacle to this, but
    not an insurmountable one.

    --
    keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jul 9, 2010
    #6
  7. Nick Guest

    Richard Heathfield <> writes:

    > Keith Thompson wrote:
    >
    > <snip>
    >
    >> Trigraphs are rarely used, but they've never been officially
    >> deprecated. (And I understand that there are still environments
    >> where there necessary and actually used.)

    >
    > Yes, they are still needed, for example in some mainframe
    > environments. They make the code look astoundingly ugly, but they do
    > at least make it work. It is not uncommon for "normal" C code to be
    > written and tested on PCs, then run through a conversion program to
    > replace monographs with trigraphs where required before transfer to
    > the mainframe for final testing. That way, you get the readability
    > where it matters, and the usability where /that/ matters.
    >
    > <snip>


    But is there anything you can do with them that you can't do with the
    more readable digraphs that came along later.

    The problem with using them for mainframes, IIRC (it's nearly 20 years
    ago since I did this) was that not everything that gets mucked about by
    IBM code pages is in the trigraph set.
    --
    Online waterways route planner | http://canalplan.eu
    Plan trips, see photos, check facilities | http://canalplan.org.uk
     
    Nick, Jul 10, 2010
    #7
  8. Nick <> writes:
    > Richard Heathfield <> writes:
    >> Keith Thompson wrote:
    >> <snip>
    >>
    >>> Trigraphs are rarely used, but they've never been officially
    >>> deprecated. (And I understand that there are still environments
    >>> where there necessary and actually used.)

    >>
    >> Yes, they are still needed, for example in some mainframe
    >> environments. They make the code look astoundingly ugly, but they do
    >> at least make it work. It is not uncommon for "normal" C code to be
    >> written and tested on PCs, then run through a conversion program to
    >> replace monographs with trigraphs where required before transfer to
    >> the mainframe for final testing. That way, you get the readability
    >> where it matters, and the usability where /that/ matters.
    >>
    >> <snip>

    >
    > But is there anything you can do with them that you can't do with the
    > more readable digraphs that came along later.


    Yes. Digraphs aren't recognized in string literals, character
    constants, header names, or comments (the latter probably isn't
    important).

    > The problem with using them for mainframes, IIRC (it's nearly 20 years
    > ago since I did this) was that not everything that gets mucked about by
    > IBM code pages is in the trigraph set.


    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jul 10, 2010
    #8
  9. sandeep Guest

    Nick Keighley writes:
    > "auto" keyword is almost useless
    > did early C have "fortran" and "entry" keywords or was that just a
    > rumour?


    I think it still has some valuable uses.

    For example in a function with lots of static variables and only one or
    two local variables, putting in an explicit auto can help emphasize that
    there are local variables at the end of the long list.

    Also it can be used to demonstrate the programmer's wide knowledge of the
    ISO Standard, in the way that flowery and obscure vocabulary is used by
    some writers to impress their readers... a bit of showing off to impress
    the maintenance programmer down the line :)
     
    sandeep, Jul 10, 2010
    #9
  10. Ian Collins Guest

    On 07/10/10 10:25 PM, sandeep wrote:
    > Nick Keighley writes:
    >> "auto" keyword is almost useless
    >> did early C have "fortran" and "entry" keywords or was that just a
    >> rumour?

    >
    > I think it still has some valuable uses.
    >
    > For example in a function with lots of static variables and only one or
    > two local variables, putting in an explicit auto can help emphasize that
    > there are local variables at the end of the long list.


    Surely the lack of "static" has as much, if not more impact?

    --
    Ian Collins
     
    Ian Collins, Jul 10, 2010
    #10
  11. Sebastian Guest

    lovecreatesbea... wrote:
    > the 2010, 03 draft std of C++ states that
    >
    > auto_ptr deprecated, use shared_ptr (boost?) instead;


    C++0x will offer unique_ptr which is a much better fit than shared_ptr
    when it comes to auto_ptr alternatives. Boith, unique_ptr and
    shared_ptr will be part of C++0x. No boost needed anymore.

    Also, "deprecated" is just a warning. It means that the standards
    committee might drop this feature in the future. auto_ptr is still
    part of C++0x.

    > were there features in C abandoned so soon like that in C++?
    > those C++ features dismissed even before many programmers
    > didn't have a single try.


    "soon"? The current C++ standard is 12 years old. You had enough time
    trying out everything. And migrating auto_ptr to unique_ptr is far
    from complicated. Just replace the types and insert a couple std::move-
    calls here and there where necessary. The same goes for bind1st and
    bind2nd. These getting deprecated should give you at least 5 years of
    migration time.

    Cheers!
    SG
     
    Sebastian, Jul 11, 2010
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Barney Barumba
    Replies:
    0
    Views:
    580
    Barney Barumba
    Jul 23, 2003
  2. Maitre Bart
    Replies:
    0
    Views:
    444
    Maitre Bart
    Oct 22, 2004
  3. Siemel Naran

    auto_ptr<Derived> to auto_ptr<Base>

    Siemel Naran, Jan 10, 2005, in forum: C++
    Replies:
    2
    Views:
    1,584
    Dave Rahardja
    Jan 11, 2005
  4. christopher diggins
    Replies:
    1
    Views:
    411
    Rapscallion
    May 23, 2005
  5. Sousuke
    Replies:
    9
    Views:
    1,185
    Bart van Ingen Schenau
    Mar 16, 2010
Loading...

Share This Page