Host introspection: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring, made p2js compatible) |
(C++ entry) |
||
Line 249: | Line 249: | ||
Console.WriteLine("Big-endian."); |
Console.WriteLine("Big-endian."); |
||
}</lang> |
}</lang> |
||
=={{header|C++}}== |
|||
<lang cpp>#include <bit> |
|||
#include <iostream> |
|||
int main() |
|||
{ |
|||
std::cout << "int is " << sizeof(int) << " bytes\n"; |
|||
std::cout << "a pointer is " << sizeof(int*) << " bytes\n\n"; |
|||
if (std::endian::native == std::endian::big) |
|||
{ |
|||
std::cout << "platform is big-endian\n"; |
|||
} |
|||
else |
|||
{ |
|||
std::cout << "host is little-endian\n"; |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre> |
|||
int is 4 bytes |
|||
a pointer is 8 bytes |
|||
host is little-endian |
|||
</pre> |
|||
=={{header|Caché ObjectScript}}== |
=={{header|Caché ObjectScript}}== |