Host introspection: Difference between revisions

Content added Content deleted
(→‎{{header|R}}: object.size not relevant)
(→‎{{header|Julia}}: A new entry for Julia)
Line 466: Line 466:
<lang java>System.out.println("word size: "+System.getProperty("sun.arch.data.model"));
<lang java>System.out.println("word size: "+System.getProperty("sun.arch.data.model"));
System.out.println("endianness: "+System.getProperty("sun.cpu.endian"));</lang>
System.out.println("endianness: "+System.getProperty("sun.cpu.endian"));</lang>

=={{header|Julia}}==
<code>Julia</code> creates <code>ENDIAN_BOM</code> a 32 bit unsigned integer out of an array of 4 8 bit unsigned integers to serve as an endianness marker.
<lang Julia>
print("This host's word size is ", WORD_SIZE, ".")
if ENDIAN_BOM == 0x04030201
println("And it is a little-endian machine.")
elseif ENDIAN_BOM == 0x01020304
println("And it is a big-endian machine.")
else
println("ENDIAN_BOM = ", ENDIAN_BOM, ", which is confusing")
end
</lang>

{{out}}
<pre>
This host's word size is 64.And it is a little-endian machine.
</pre>


=={{header|Mathematica}}==
=={{header|Mathematica}}==