By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,120 Members | 1,275 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,120 IT Pros & Developers. It's quick & easy.

Casting to pointer reference?

P: n/a
Hi,

can anyone help me with understanding what is the purpose of ampersand sign
in following cast : (UNALIGNED DWORD*&) ? Below is code snipet where I
spoted this.

thanx

BOOL CWnd::ExecuteDlgInit(LPVOID lpResource)
{
BOOL bSuccess = TRUE;
if (lpResource != NULL)
{
UNALIGNED WORD* lpnRes = (WORD*)lpResource;
while (bSuccess && *lpnRes != 0)
{
WORD nIDC = *lpnRes++;
WORD nMsg = *lpnRes++;
DWORD dwLen = *((UNALIGNED DWORD*&)lpnRes)++; // *& -> ?????
//...
}
// ...
}
//...
}
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mon, 11 Jul 2005 09:06:27 +0200, "Mrtn" <un*****@wp.pl> wrote:
DWORD dwLen = *((UNALIGNED DWORD*&)lpnRes)++; // *& -> ?????


I believe this is legal ... check section 5.2.10 "Reinterpret_cast",
paragraph 10 for more details.

Don't know exactly why it is used this way ... maybe to keep the
compiler from generating a copy of the pointer?

--
Bob Hairgrove
No**********@Home.com
Aug 5 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.