Search:

Type: Posts; User: dandrestor

Search: Search took 0.01 seconds.

  1. I think getline discards the delimiter (by...

    I think getline discards the delimiter (by default '\n') so you should be testing for "" instead of "\n".
  2. Replies
    18
    Views
    5,680

    What laserlight is advising is called RAII, and...

    What laserlight is advising is called RAII, and it's one of the fundamental things to learn in C++.
  3. Refactoring a 900-line, non-repetitive function...

    Refactoring a 900-line, non-repetitive function into smaller functions does not only split the text into regions, like paragraphs would. The important benefit in doing this decomposition is the...
  4. I disagree, debugging 900 lines of code sharing...

    I disagree, debugging 900 lines of code sharing the same state is totally different than debugging 90 chunks of 10 lines, each with its own state, preconditions, postconditions and invariants.
  5. Laserlight is absolutely right. While minimizing...

    Laserlight is absolutely right. While minimizing function length is not a goal in itself, I think decomposing the problem into manageable, non-repetitive and easily debuggable chunks will lead to...
  6. Replies
    18
    Views
    2,007

    Good point! I didn't know that, thanks!

    Good point! I didn't know that, thanks!
  7. Glad you could make it work. There are many good...

    Glad you could make it work. There are many good habits that you should learn, especially if you're just starting programming. Search on the net, there's a ton of good literature out there....
  8. Replies
    18
    Views
    2,007

    In that case, the answer is simply "no, you can't...

    In that case, the answer is simply "no, you can't have a virtual default-destructor without writing any code, because the default destructor is implicitly non-virtual", as the OP noticed.

    The...
  9. Replies
    18
    Views
    5,680

    You can try Boost Tokenizer (Boost Tokenizer...

    You can try Boost Tokenizer (Boost Tokenizer Overview - 1.36.0).

    Alternatively, try std::string::find and std::string::substr.
  10. break will only break out of the innermost for...

    break will only break out of the innermost for loop. Try return instead.
    Also, make sure you initialize your variable. This will also eliminate the need for that last "if" statement (which has no...
  11. Thanks for your thoughts. I am going down the...

    Thanks for your thoughts. I am going down the path of one header with multiple implementations, perhaps hidden behind a pimpl.
  12. I haven't fully read your source code, but at...

    I haven't fully read your source code, but at first glance I see that you have a lot of code duplication in your main do/while game loop.
    I would do something like:



    bool over = false;
    int...
  13. Replies
    18
    Views
    2,007

    In C++11, you can declare a default virtual...

    In C++11, you can declare a default virtual destructor, by writing

    class Foo {
    virtual ~Foo() = default;
    };

    HTH,
    Dan
  14. Plus, using const while passing by value should...

    Plus, using const while passing by value should be avoided anyway.
  15. Using typedefs to abstract multiple implementations

    Hello everybody! This is my first post on this forum.

    I am writing a program that aims to be cross-platform, so it supports multiple low-level implementations for certain operations. My initial...
Results 1 to 15 of 15