Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link
added 68 characters in body
Source Link
Summer
  • 2.4k
  • 2
  • 16
  • 31
deleted 615 characters in body
Source Link
Summer
  • 2.4k
  • 2
  • 16
  • 31

But also why are you using raw pointers?

Qt has Smart Pointers . That's assuming the Standard ones aren't sufficient, which they ought to be. Smart Pointers abstract the hard parts of memory management and help keep you leak free.

That said. Do you need pointers at all? Now I return to my disclaimer. I did read the documentation on Signal/Slots in Qt only briefly but I believe you can generate all of your Objects as pointer-free RAII class instances.

You declare a (needed) destructor for cleanup of all your pointers. If you declare a destructor you need a Copy Constructor, a Copy Assignment Operator, a Move Constructor and a Move Assignment Operator as well. However if you eliminate your pointers you can remove your destructor and rely on the rule of 0 (Don't declare any of them let the compiler do it.)

But also why are you using raw pointers?

Qt has Smart Pointers . That's assuming the Standard ones aren't sufficient, which they ought to be. Smart Pointers abstract the hard parts of memory management and help keep you leak free.

That said. Do you need pointers at all? Now I return to my disclaimer. I did read the documentation on Signal/Slots in Qt only briefly but I believe you can generate all of your Objects as pointer-free RAII class instances.

You declare a (needed) destructor for cleanup of all your pointers. If you declare a destructor you need a Copy Constructor, a Copy Assignment Operator, a Move Constructor and a Move Assignment Operator as well. However if you eliminate your pointers you can remove your destructor and rely on the rule of 0 (Don't declare any of them let the compiler do it.)

You declare a (needed) destructor for cleanup of all your pointers. If you declare a destructor you need a Copy Constructor, a Copy Assignment Operator, a Move Constructor and a Move Assignment Operator as well.

Source Link
Summer
  • 2.4k
  • 2
  • 16
  • 31
Loading
lang-cpp

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