Re: Any Method to Determine Endianness at Compile Time ?



Richard Tobin wrote:
Willem <willem@xxxxxxxx> wrote:

int main(void) {
union {
char c;
int i;
} u;
u.i = 0;
u.c = 1;

if (u.i == 1)
printf("little endian\n");
else
printf("big endian\n");
}

Isn't that a run time solution ?

Not if you run it at compile time :-)

On the cross-compiler !!

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages