Hacker News new | past | comments | ask | show | jobs | submit login

Thanks for the example!

Checks linked resources

      while(!ss.eof()){
        ss >> token;
Can cause an endless loop (with finite input stream; for example in case of a read error).

    p >> x;
    if(!p.fail() && p.eof()){
This way of error checking is correct for C++ but not nice (it or part of it can be forgotten with no warning--see below for an instance of it :P).

    struct stack_empty_error: public std::exception{
      const char\* what() const throw(){
Missing "override" annotation here. Can easily fuck it up since overloads are allowed.

        return " ==> Error: stack empty." ;
      }
    };



    auto x = _stack.back();
    _stack.pop_back();
    return x;
Correct in C++ but incredibly weird--typical for lowlevel languages that are far away from the user.

Also, when I press Ctrl-D, I get an endless loop printing "EXPR+> stack". Typical C++ program...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: