Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (jp)

...

Code Block
bgColor#ccccff
class Handle {
  public:
    Handle();
    ~Handle() {} // correct.
    // ...
  private:
    std::tr1::shared_ptr<Body>ptr&lt;Body&gt; impl_;
};

Note that we used a shared_ptr to refer to the Body. Other common smart pointers, including std::auto_ptr, will still produce undefined behavior.

...

Code Block
bgColor#FFcccc
class B {
    // ...
};
B *getMeSomeSortOfB();
// ...
class D; // incomplete declaration
// ...
B *bp = getMeSomeSortOfB();
D *dp = (D *)bp; // old-stlye cast: legal, but inadvisable
dp = reinterpret_cast<Dcast&lt;D *>&gt;(bp); // new-style cast: legal, but inadvisable

...

Wiki Markup
\[[Dewhurst 03|AA. C++ References#Dewhurst 04]\]  Gotcha 39: Casting Incomplete Types

...

EXP35-C. Ensure that the right hand operand of a shift operation is within range      03. Expressions (EXP)      04. Integers (INT)