<!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>> Yes, linux does define the BYTE_ORDER macro, but it may not be defined </FONT>
<BR><FONT SIZE=2>> in other operating systems (windows?).</FONT>
</P>
<P><FONT SIZE=2>Who cares? But if you do care, why not find out?</FONT>
</P>
<P><FONT SIZE=2>> I'm just wondering if C Standard requires this macro to be defined by </FONT>
<BR><FONT SIZE=2>> all compilers, then I can be sure that mine would be a truly portable </FONT>
<BR><FONT SIZE=2>> 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> 1. Find something like I suggested that works on all the</FONT>
<BR><FONT SIZE=2> platforms you care about; or</FONT>
</P>
<P><FONT SIZE=2> 2. Write your own macro and use that -- it's incredibly</FONT>
<BR><FONT SIZE=2> trivial, after all.</FONT>
</P>
<P><FONT SIZE=2>You might also ask yourself why you're doing this at all. 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>: <A HREF="http://lists.linux.org.au/listinfo/linuxcprogramming" TARGET="_blank">http://lists.linux.org.au/listinfo/linuxcprogramming</A> List</FONT>
</P>
</BODY>
</HTML>