473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Q: Can I simply this expression?

Pardon the Windows types :)... they are just pointers to DWORDs and BYTEs...
Is there a way to simplify this monstrosity?

BOOL (CFile::*pFunc)(CFileStatus&) const = &CFile::GetStatus;

TRACE("%x\n", *((LPDWORD)(*((LPDWORD)(((LPBYTE)*((LPDWORD)&pFunc )) + 2)))));

I *think* what this is supposed to mean is:

pFunc is a ptr to a func, I need to take the address of that + 2 bytes then
double indirect it as dword addresses :).
Feb 2 '08 #1
2 1144

"Somebody" <so******@cox.netwrote in message
news:tZ*******************@newsfe17.lga...
Pardon the Windows types :)... they are just pointers to DWORDs and
BYTEs... Is there a way to simplify this monstrosity?

BOOL (CFile::*pFunc)(CFileStatus&) const = &CFile::GetStatus;

TRACE("%x\n", *((LPDWORD)(*((LPDWORD)(((LPBYTE)*((LPDWORD)&pFunc )) +
2)))));

I *think* what this is supposed to mean is:

pFunc is a ptr to a func, I need to take the address of that + 2 bytes
then double indirect it as dword addresses :).

Got it down to this:

TRACE("%x\n", **((LPDWORD*)((*((LPDWORD)&pFunc)) + 2)));

A little nicer :), can I do any better?
Feb 2 '08 #2
Somebody wrote:
Got it down to this:

TRACE("%x\n", **((LPDWORD*)((*((LPDWORD)&pFunc)) + 2)));

A little nicer :), can I do any better?
TRACE("%x\n", **(LPDWORD*)(*(LPDWORD) &pFunc + 2));

--
Best regards,
Andrey Tarasevich
Feb 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Paul Rubin | last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd like to use an assignment expression, like for line in file: if (g := re.match(pat, line)): croggle(g.group(1)) Since...
70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
22
by: Tony Johansson | last post by:
Hello Experts! I'm reading i a book about C++ and they mention infix with telling what it is. I hope you out there can do so. Many thanks! //Tony
2
by: Mike Turco | last post by:
I like using the expression builder for a lot of different things but it isn't always available when I want to use it, for example in the code window, or in all of the control properties. I am...
3
by: Jason luo | last post by:
Hi all, In c99-standard page 52,there is a sentence about void,as below: If an expression of any other type is evaluated as a void expression, its value or designator is discarded. I don't...
14
by: John Temples | last post by:
Given this code: extern volatile unsigned char v; int main(void) { v; return 0; }
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
9
by: sarathy | last post by:
Hi, Can anyone just help me with what exactly is constant expression. I read the section on Constant expression in K&R2. i am not fully clear with it.
1
by: lovecreatesbea... | last post by:
---quoting--- Annex C (informative) Sequence points 1 The following are the sequence points described in 5.1.2.3: - The end of a full expression: an initializer (6.7.8); the expression in an...
18
by: dspfun | last post by:
Hi! The words "expression" and "statement" are often used in C99 and C- textbooks, however, I am not sure of the clear defintion of these words with respect to C. Can somebody provide a sharp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.