Re: c type short int to euphoria int conversion

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

I'm calling a c api that returns a boolean value (defined as a unsigned short int in the c header file) and I assign this to a euphoria integer. Since the boolean value is an error code either a 1 or 0. When I test the Euphoria integer I don't get a 1 but some other value. Is it safe for me to assume that anything other than a 0 is the same as a 1 in the short int I retrieve and that if the short int is a zero it will still be a zero when assigned to eu integer. Or am I way off and there is a better way. Thanks

C is similar to euphoria in that 0 is considered false, and any other value is true. A short int is a 16 bit value, which is smaller than a euphoria integer, so you're not losing any information.

What value do you get in the return? Is it always the same? Do you have access to the source code for whatever library you're calling?

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu