• Amend request (throwing error)

    From WIJ@21:1/5 to All on Fri Mar 18 13:13:20 2016
    The concept and usage of error handling mechanism(throw,catch) should
    have now been more widely understood through painful experiences that
    it isn't suitable at all for the general programming idea of
    'error handling'. For instance:

    void f(int v)
    {
    if(v<5) throw std::invalid_argument("v<5");
    ...
    };

    void g() try {
    f(2);
    }
    catch(std::invalid_argument& e) {
    // 1. The captured e is sensitive to the context, e.g. any functions
    // used particularly implicit ones, and library linked.
    // 2. No guarantee e is what the programmer expected!
    };

    The impact is deep in any C++ components using ctor,dtor or operator=,
    ..,etc, involving implicit conversions. Since the globally practical
    function of the standard is educational. Text books and derivatives
    have to be written on documents published by the standard committee or
    C++ authorities. People writting documents feels difficult addressing
    it differently. Please consider removing such 'error handling' suggest
    and add some warning addressing or amend this issue.



    --
    [ comp.std.c++ is moderated. To submit articles, try posting with your ]
    [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
    [ --- Please see the FAQ before posting. --- ]
    [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)