Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link
  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

    The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

    You could instead do a using std::cout; or better qualify the three use-sites.

You could instead do a using std::cout; or better qualify the three use-sites.

  1. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List owning and managing the whole lot.

  2. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  3. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  4. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  5. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  6. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

  7. this should rarely be used explicitly.

  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

You could instead do a using std::cout; or better qualify the three use-sites.

  1. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List owning and managing the whole lot.

  2. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  3. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  4. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  5. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  6. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

  7. this should rarely be used explicitly.

  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

    You could instead do a using std::cout; or better qualify the three use-sites.

  2. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List owning and managing the whole lot.

  3. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  4. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  5. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  6. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  7. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

  8. this should rarely be used explicitly.

added 248 characters in body
Source Link
Deduplicator
  • 19.8k
  • 1
  • 32
  • 65
  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

    The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

You could instead do a using std::cout; or better qualify the three use-sites.

  1. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List owning and managing the whole lot.

  2. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  3. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  4. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  5. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  6. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

  7. this should rarely be used explicitly.

  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

  2. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List.

  3. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  4. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  5. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  6. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  7. this should rarely be used explicitly.

  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

You could instead do a using std::cout; or better qualify the three use-sites.

  1. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List owning and managing the whole lot.

  2. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  3. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  4. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  5. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  6. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

  7. this should rarely be used explicitly.

Source Link
Deduplicator
  • 19.8k
  • 1
  • 32
  • 65
  1. The namespace std is not designed for wholesale importation, see "Why is "using namespace std" considered bad practice? " for more detail.

  2. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of Nodes. Consider putting it all into a List.

  3. Trying to remove() the root-Node uncovers a bug. Try to trace it through.

  4. pointer != nullptr is just a long-winded way to write pointer in a boolean context. Respectively for pointer == nullptr and !pointer. Yes, Java needs that, but this is C++.

  5. When you return from the if-branch, putting the alternative in an else-branch is superfluous.

  6. A function for printing an object should allow the caller to specify the stream, and be called operator<<.

  7. this should rarely be used explicitly.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /