<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.73">
<TITLE>RE: [LCP]#defines to know Endianness</TITLE>
</HEAD>
<BODY>
<BR>
<BR>

<P><FONT SIZE=2>Hope you have already figured out what the macro can look like, one suggestion is declare an int, store it in memort extract the bit storage pattern and u have the endianess exposed!! </FONT></P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: linuxcprogramming-admin@lists.linux.org.au [<A HREF="mailto:linuxcprogramming-admin@lists.linux.org.au">mailto:linuxcprogramming-admin@lists.linux.org.au</A>] On Behalf Of Greg Black</FONT></P>

<P><FONT SIZE=2>Sent: Thursday, July 01, 2004 5:22 PM</FONT>
<BR><FONT SIZE=2>To: linuxcprogramming@lists.linux.org.au</FONT>
<BR><FONT SIZE=2>Subject: Re: [LCP]#defines to know Endianness</FONT>
</P>

<P><FONT SIZE=2>On 2004-07-01, John Navil Joseph wrote:</FONT>
</P>

<P><FONT SIZE=2>&gt; Yes, linux does define the BYTE_ORDER macro, but it may not be defined </FONT>
<BR><FONT SIZE=2>&gt; in other operating systems (windows?).</FONT>
</P>

<P><FONT SIZE=2>Who cares?&nbsp; But if you do care, why not find out?</FONT>
</P>

<P><FONT SIZE=2>&gt; I'm just wondering if C Standard requires this macro to be defined by </FONT>
<BR><FONT SIZE=2>&gt; all compilers, then I can be sure that mine would be a truly portable </FONT>
<BR><FONT SIZE=2>&gt; code.</FONT>
</P>

<P><FONT SIZE=2>The C Standard does not care about stuff like that and there is nothing it offers for it.</FONT>
</P>

<P><FONT SIZE=2>You have two choices:</FONT>
</P>

<P><FONT SIZE=2>&nbsp; 1. Find something like I suggested that works on all the</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; platforms you care about; or</FONT>
</P>

<P><FONT SIZE=2>&nbsp; 2. Write your own macro and use that -- it's incredibly</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; trivial, after all.</FONT>
</P>

<P><FONT SIZE=2>You might also ask yourself why you're doing this at all.&nbsp; It's rare for well-written code to need to know stuff like this.</FONT></P>

<P><FONT SIZE=2>Cheers, Greg</FONT>
<BR><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>This is the Linux C Programming List</FONT>
<BR><FONT SIZE=2>:&nbsp; <A HREF="http://lists.linux.org.au/listinfo/linuxcprogramming" TARGET="_blank">http://lists.linux.org.au/listinfo/linuxcprogramming</A> List</FONT>
</P>

</BODY>
</HTML>