On Tue, Aug 9, 2011 at 12:25 AM, 陳國成 <gcchen.org@xxxxxxxxx> wrote:
Hi all,Please tell me the difference between using unsigned short and __be16 to declear a variable in a data structure.
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 "short" or "unsigned short", but other possibilities exist.
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.
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.
--
Kevin O'Gorman, PhD
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies