Pelles C forum

C language => Windows questions => Topic started by: Abraham on October 27, 2018, 01:32:40 AM

Title: Programming Windows, 5th Edition (weird typecast requirement for x64)?
Post by: Abraham on October 27, 2018, 01:32:40 AM
Chapter 16

Project Dibble

Code: [Select]
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.
Code: [Select]
case 24: * (RGBTRIPLE *) pPixel = * (RGBTRIPLE *) (uintptr_t) (void *) &dwPixel ;
Title: Re: Programming Windows, 5th Edition (weird typecast requirement for x64)?
Post by: TimoVJL on October 27, 2018, 08:29:06 AM
PellesC 9 issue.
A short example for that:
Code: [Select]
#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);
}