Programming Windows, 5th Edition (weird typecast requirement for x64)?

Started by Abraham, October 27, 2018, 01:32:40 AM

Previous topic - Next topic

Abraham

Chapter 16

Project Dibble

case 24: * (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) &dwPixel ;
error #3114: [asm] Invalid combination of opcode and operand

Solution: cannot de-reference (RGBTRIPLE *) without typecasting to uintptr_t.
case 24: * (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) (uintptr_t) (void *) &dwPixel ;


TimoVJL

PellesC 9 issue.
A short example for that:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
PellesC 9 issue.
A short example for that:
void __cdecl WinMainCRTStartup(void)
{

DWORD dwPix, dwPixel = 0x123456;
void *pPixel;
//pPixel = &dwPix; // test
* (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) &dwPixel ;
* (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) (void*) &dwPixel ;
ExitProcess(0);
}
May the source be with you