Click here to Skip to main content
15,917,875 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Image rotation using RotateTransform()???? Pin
Mark Salsbery12-Mar-08 18:26
Mark Salsbery12-Mar-08 18:26 
GeneralRe: Image rotation using RotateTransform()???? Pin
TooShy2Talk12-Mar-08 19:08
TooShy2Talk12-Mar-08 19:08 
QuestionRe: Image rotation using RotateTransform()???? Pin
TooShy2Talk12-Mar-08 19:53
TooShy2Talk12-Mar-08 19:53 
AnswerRe: Image rotation using RotateTransform()???? Pin
Rajkumar R12-Mar-08 21:05
Rajkumar R12-Mar-08 21:05 
GeneralRe: Image rotation using RotateTransform()???? Pin
TooShy2Talk12-Mar-08 22:26
TooShy2Talk12-Mar-08 22:26 
GeneralRe: Image rotation using RotateTransform()???? Pin
Mark Salsbery13-Mar-08 6:34
Mark Salsbery13-Mar-08 6:34 
QuestionThread Response Time Pin
jonsey2984712-Mar-08 17:15
jonsey2984712-Mar-08 17:15 
GeneralRe: Thread Response Time Pin
krmed13-Mar-08 1:59
krmed13-Mar-08 1:59 
GeneralRe: Thread Response Time Pin
jonsey2984713-Mar-08 12:20
jonsey2984713-Mar-08 12:20 
QuestionRe: Thread Response Time Pin
David Crow13-Mar-08 2:24
David Crow13-Mar-08 2:24 
GeneralRe: Thread Response Time Pin
jonsey2984713-Mar-08 12:30
jonsey2984713-Mar-08 12:30 
QuestionRe: Thread Response Time Pin
David Crow14-Mar-08 2:39
David Crow14-Mar-08 2:39 
AnswerRe: Thread Response Time Pin
jonsey2984718-Mar-08 4:30
jonsey2984718-Mar-08 4:30 
Generalopaque pointer Pin
George_George12-Mar-08 16:36
George_George12-Mar-08 16:36 
GeneralRe: opaque pointer Pin
Maxwell Chen12-Mar-08 18:30
Maxwell Chen12-Mar-08 18:30 
GeneralRe: opaque pointer Pin
George_George12-Mar-08 18:35
George_George12-Mar-08 18:35 
GeneralRe: opaque pointer Pin
Maxwell Chen12-Mar-08 18:42
Maxwell Chen12-Mar-08 18:42 
GeneralRe: opaque pointer Pin
George_George12-Mar-08 18:49
George_George12-Mar-08 18:49 
GeneralRe: opaque pointer Pin
Maxwell Chen12-Mar-08 18:54
Maxwell Chen12-Mar-08 18:54 
GeneralRe: opaque pointer Pin
George_George12-Mar-08 18:56
George_George12-Mar-08 18:56 
GeneralRe: opaque pointer Pin
Eytukan13-Mar-08 7:03
Eytukan13-Mar-08 7:03 
AnswerRe: opaque pointer Pin
Maxwell Chen13-Mar-08 9:24
Maxwell Chen13-Mar-08 9:24 
GeneralRe: opaque pointer Pin
George_George13-Mar-08 15:14
George_George13-Mar-08 15:14 
GeneralRe: opaque pointer Pin
Eytukan13-Mar-08 16:06
Eytukan13-Mar-08 16:06 
That deals with just one case. But the article has not talked about the dangerous side of it. If you are have hard pointers like that, there's heck a lot of chances that you'll end up in memory leaks. If the program is 21 odd lines, then there's no problem. But in an application that has 40-50 thousand lines, if you are implementing hard pointers like this, that's it. It's an assured dissaster. I guess opaque pointers fit more better for the raw C guys and not C++. I'll give a little example here:
<br />
class MyApp<br />
{<br />
<br />
  MyGun* pmygun;<br />
  MyBomb* pBomb;<br />
  MyMissle* pMissile;<br />
.<br />
.<br />
.<br />
<br />
}<br />
MyApp()<br />
{<br />
   //Many of these pointers will not get initialized here.<br />
}<br />
<br />
LoadWeapon(Handle,Type)<br />
{<br />
  // Load few<br />
}<br />
<br />
UnloadWeapon(Handle,Type)<br />
{<br />
<br />
}<br />
<br />
<br />
~MyApp()<br />
{<br />
  // Here you have the burden to check if allll the weaopns have been unloaded. Forgetting it would shatter your desktop ;)<br />
}<br />

And sometime back my mate had such a pointer(pobj) in his MyAppclass, and in the destructor he kept calling pobj->release() without checking if it's been initialized or not. In most of the circumstances it got initialized and it went fine, but a tricky flow got thru these initializing conditions and when the destructor of the MyApp class got called, it crashed the application. This is just one example . I've seen a lot more like that.

I wish to suggest something called the smart-pointers.





OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus


Best wishes to Rexx[^]

GeneralRe: opaque pointer Pin
George_George13-Mar-08 16:32
George_George13-Mar-08 16:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.