Re: define_c_func/proc and 64-bit return types

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

In 4.1, C_LONGLONG is set to #03000002

That is a 16-bit float, if you remember such things.
[Assuming you are being totally explicit with your types], a signed 64 bit int should be #01000008 and an unsigned 64 bit int should be #02000008

I didn't create those constants, someone else did. I didn't realize that there was a standard convention though... where are you getting this from?

petelomax said...
mattlewis said...

Several things needed to be changed. In particular, things like C_INT and C_LONG were treated the same way in 4.0, which is a valid assumption for a 32-bit OS, but not for 64-bits.

Just to nitpick, it is the 64-bit application, not the 64-bit OS it must run on, that makes such assumptions invalid.

It's actually up to the compiler, not the application. The OS does have influence here however, as most compilers follow the convention of the OS that they are compiling to (or perhaps it's that the OS follows the convention of the compiler that is used to build the OS?).

petelomax said...

As far as Ansi/Unicode versions of dll routines go, don't we just leave that up to the programmer? Should 64-bit really be any different?

I don't understand what you mean. Leave what up to the programmer?

petelomax said...

As you say, 32-bit apps need to be able to throw 64-bit ints around, so I would add explicit C_I32, C_I64, C_UI32, C_UI64, etc

This works for me. Even C typically has a set of types/typedefs that define int8_t and uint8_t, etc.

petelomax said...

as well as changing C_INT from #01000004 on 32-bit to #01000008 on 64-bit.

Why? C's int is still 4 bytes on gcc/linux/gnu .. What would be the point? What platform has 8 byte sized ints such that the C compiler has sizeof(int) == 8?

petelomax said...

I would also say a 64-bit compiler should generate 64-bit apps; if you want to generate 32-bit apps on a 64-bit box then you should (also) install the 32-bit compiler. If the source has to differ, so be it.

Pete

Euphoria gets away with it because it is not a compiler per se. The 64bit vs 32bit headaches can (mostly) be left to the underlying C compiler, but we do have ifdefs to allow the source to be flexible in those cases where the programmer has to (or simply wants to) deal with those issues upfront.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu