Re: How do MAKEINTRESOURCE in Euphoria?
- Posted by CoJaBo2 May 16, 2013
- 2073 views
mattlewis said...
This appears to be casting to a WORD (16-bit unsigned) and then up into a pointer, so you should be able to do:
function MAKEINTRESOURCE( atom x ) return and_bits( 0xffff, x ) end function
This isn't correct; the primary purpose of that is to do the typecast, so that Windows can store a 16-bit integer ID in a type defined as "pointer" for convoluted reasons; Eu doesn't have types, so in Eu this macro would be a complete no-op.
If you want to be safe, you can do an assert/check to make sure the ID is less than 0xffff, as something is wrong if it isn't. If you just mask it to 16 bits, like the code above, you'll silently corrupt the incorrect value into another incorrect value.