Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How can I use a preprocessorif expression to ? ....
How can I use a preprocessor #if expression to tell whether a machine's byte order is big-endian or little-endian?
✍: Guest
You probably can't. The usual techniques for detecting endianness involve pointers or arrays of char, or maybe unions, but preprocessor arithmetic uses only long integers, and there is no concept of addressing. Another tempting possibility is something like
#if 'ABCD' == 0x41424344
but this isn't reliable, either. At any rate, the integer formats used in preprocessor #if expressions are not necessarily the same as those that will be used at run time.
Are you sure you need to know the machine's endianness explicitly? Usually it's better to write code which doesn't care
2016-02-01, 1654👍, 0💬
Popular Posts:
What is Native Image Generator (Ngen.exe)? The Native Image Generator utility (Ngen.exe) allows you ...
What print out will the folloging code produce? main() { char *p1=“name”; char *p2; p2=(char*)malloc...
What will be printed as the result of the operation below: main() { int x=10, y=15; x = x++; y = ++y...
How To Export Data to a CSV File? - Oracle DBA FAQ - Introduction to Oracle SQL Developer If you wan...
Wha is the output from System.out.println("Hell o"+null);?Hellonull