Re: Any Method to Determine Endianness at Compile Time ?
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Wed, 19 Mar 2008 16:35:29 -0500
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
.
- References:
- Any Method to Determine Endianness at Compile Time ?
- From: perry.yuan
- Re: Any Method to Determine Endianness at Compile Time ?
- From: jacob navia
- Re: Any Method to Determine Endianness at Compile Time ?
- From: Willem
- Re: Any Method to Determine Endianness at Compile Time ?
- From: Richard Tobin
- Any Method to Determine Endianness at Compile Time ?
- Prev by Date: Re: How to stop these bluddy spammers...
- Next by Date: Re: Any Method to Determine Endianness at Compile Time ?
- Previous by thread: Re: Any Method to Determine Endianness at Compile Time ?
- Next by thread: Re: Any Method to Determine Endianness at Compile Time ?
- Index(es):
Relevant Pages
|