Get integer bytes order in a compile time

A

Alexander Veremyev

Hi All,

Is there any possibility in a C standard to get integer bytes order
in a compile time?

With best regards,
Alexander Veremyev.
 
E

Eric Sosman

Alexander said:
Hi All,

Is there any possibility in a C standard to get integer bytes order
in a compile time?

There is no Standard macro or feature that provides
this information. Also, it is not possible to write your
own because the preprocessor has no notion of "address."

You could write a "helper" program to determine the
byte order (at its own run-time) and output its result
in a header that the target program could #include in
its compilation.
 
B

baumann@pan

you can write a function to detect the big /little endian of the
processor.

so you write other related function with the one as it can help u
understand what endian mode it is in runtime.


hints, think , you can define a var 0x01020304, then use each byte in
it as an index for 4-byte-long data...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top