Prev: "PORTING C" > Over including header declarations?
Next: Please vote for bug 522094: warning C4717 + stack overflow!
From: Nic on 2 Jan 2010 14:39 For the following class: class CPoint: public tagPOINT { public: CPoint(LPARAM lParam) { x = GET_X_LPARAM(lParam); y = GET_Y_LPARAM(lParam); } }; is it safe to use it as follows: OnLButtonDown(&CPoint(lParam)); Thanks Nic
From: Igor Tandetnik on 3 Jan 2010 00:13
Nic wrote: > For the following class: > > class CPoint: public tagPOINT > { > public: > CPoint(LPARAM lParam) > { > x = GET_X_LPARAM(lParam); > y = GET_Y_LPARAM(lParam); > } > }; > > is it safe to use it as follows: > > OnLButtonDown(&CPoint(lParam)); Looks OK to me, assuming OnLButtonDown doesn't try to save the pointer somewhere for later use. Any reason it takes a pointer and not a const reference? -- With best wishes, Igor Tandetnik With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925 |