Re: Euphoria 32 & 64 Bits

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...
petelomax said...
SDPringle said...
if machine::ADDRESS_LENGTH = 8 then 

Is that really a double colon?

FYI, Phix has machine_word() [4 or 8] and machine_bits() [32 or 64], both of which are resolved by the front end, which then goes on to completely optimise away both the test itself and all of the unnecessary branch's code block.

No. Maybe he meant a single colon, but the most "correct" way to handle platform differences should be to use ifdef blocks like this:

ifdef BITS64 then 
 
    /* 64-bit code here */ 
 
elsedef -- BITS32 
 
    /* 32-bit code here */ 
 
end ifdef 

While you could also use BITS32, this method is backwards-compatible with Euphoria 4.0 since BITS64 won't exist on that version, and it will fall through to the elsedef condition automatically.

Euphoria 4.1 also added architecture definitions for X86, X86_64, and ARM (32-bit). I'm hoping to get 64-bit ARM builds working as well, which would probably rename ARM to ARMHF and add AARCH64.

Of course memstructs will take care of most of this by dealing with pointers and whatnot automatically. I've been working on some real-world testing with memstructs to make sure it's stable enough for use.

-Greg

ifdef statements are the way to go IMO. Also, that memstruct feature will be very hand, especially for wrapping libraries. Can't wait for it!

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

Search



Quick Links

User menu

Not signed in.

Misc Menu