Discussion:
Using POINT in a class.
(too old to reply)
Nic
2010-01-02 19:39:20 UTC
Permalink
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
Igor Tandetnik
2010-01-03 05:13:59 UTC
Permalink
Post by Nic
class CPoint: public tagPOINT
{
CPoint(LPARAM lParam)
{
x = GET_X_LPARAM(lParam);
y = GET_Y_LPARAM(lParam);
}
};
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
Continue reading on narkive:
Loading...