From: Nic on
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
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