Re: How do MAKEINTRESOURCE in Euphoria?

new topic     » goto parent     » topic index » view thread      » older message » newer message
CoJaBo2 said...

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.

My understanding was that with C, when you cast to a smaller integer type, then you lose bits. Casting back to a larger integer type does not restore the lost bits. In that case, mattlewis's code properly emulates the C behavior.

CoJaBo2 said...

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.

Agreed. Better to assert and fail early, than to do it the C way and fail bizarrely.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu