T O P I C R E V I E W |
AGL |
Posted - Mar 01 2006 : 01:21:55 AM I'm using VAX1440 under VS6 See expression below:
DWORD ofslcharset = (DWORD)&((LOGFONTW*)NULL)->lfCharSet;
VAX can't tell where "lfCharSet" member is declared. But in the same expression with two additional brackets:
DWORD ofslcharset = (DWORD)&(((LOGFONTW*)NULL)->lfCharSet);
it works fine. |
5 L A T E S T R E P L I E S (Newest First) |
jpizzi |
Posted - Mar 02 2006 : 10:37:16 PM Well, I haven't ever had to do that, but I know of the "offsetof" way to do it. But, I just looked it up, and it is a macro that expands to exactly your code! Wow. Learn something new everyday. |
feline |
Posted - Mar 02 2006 : 6:30:23 PM very occasionally i need to get the offset into a structure, and i am sure i do it in a simpler looking manor.
*considers* however i actually have an instance of the structure in hand when i do this, which makes it easier. |
AGL |
Posted - Mar 02 2006 : 01:11:52 AM >jpizzi This code is needed to get offset to lfCharSet member from beginning of structure LOGFONTW |
jpizzi |
Posted - Mar 02 2006 : 12:17:00 AM quote: DWORD ofslcharset = (DWORD)&((LOGFONTW*)NULL)->lfCharSet; DWORD ofslcharset = (DWORD)&(((LOGFONTW*)NULL)->lfCharSet);
Wow. I'm having trouble parsing that. It looks to me like you are explicitly de-referencing a NULL pointer, and then taking the address of the result. How is that supposed to work? (I know, that doesn't make too much difference to the question you posed, but....) |
feline |
Posted - Mar 01 2006 : 7:11:15 PM if you mean that lfCharSet is underlined as a mistyped symbol in the first line then i am seeing the same thing here. if you mean something else then i do not follow.
case=1014 |