<br><br><div class="gmail_quote">On Tue, Aug 9, 2011 at 12:25 AM, 陳國成 <span dir="ltr">&lt;<a href="mailto:gcchen.org@gmail.com">gcchen.org@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>Hi all,</div>
<div> </div>
<div>Please tell me the difference between using unsigned short and __be16 to declear a variable in a data structure.</div><br></blockquote><div>The purpose of this and similar artificial types is to allow the code to be written in an architecture-independent way.  The name is chosen to reflect the behavior (signedness, capacity, precision, etc) that is desired, and the headers for each architecture typedef it to a standard C type that accomplishes this goal.  From the name, I expect this to be a 16-bit type.  It may have other attributes, such as a specific endianness (unusual except in networking), or specific signedness.  Except on unusual or antique architectures, I would expect this one to resolve to &quot;short&quot; or &quot;unsigned short&quot;, but other possibilities exist.<br>
<br>What you should usually do is to find the typedef of __be16 in the headers and see if there is a clue to what use this type is intended for. <br></div></div><br>-- <br>Kevin O&#39;Gorman, PhD<br><br>