Print

Print


I am in the process of moving some code onto a 64-bit machine. In order to keep the code portable I thought I could use SELECTED_INT_KIND, say, to detect whether I was on a 32-bit or 64-bit platform. I thought something like SELECTED_INT_KIND(12) should return -1 if I was on 32-bit. However, is it safe to assume this is going to work in all cases? I think that it is possible that a 32-bit compiler could emulate longer integers and thus return a positive kind number to the above inquiry. Is this a realistic doubt, i.e. are there compilers that actually do emulate longer integer types, in the way that some 32-bit compilers have REAL*16. And if so, is there another protable way of determining the architecture, preferably using elemental intrinsics that are valid in initialization expressions, for example to replace:

	logical, parameter :: l64 = selected_int_kind(12) > 0

Thanks for any help anyone can give on this one,
Cheers
Simon.