From owner-freebsd-questions Thu Jan 31 14:30:57 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.inka.de (quechua.inka.de [212.227.14.2]) by hub.freebsd.org (Postfix) with ESMTP id 94DA037B402 for ; Thu, 31 Jan 2002 14:30:52 -0800 (PST) Received: from kemoauc.mips.inka.de (uucp@) by mail.inka.de with local-bsmtp id 16WPjH-0001oV-00; Thu, 31 Jan 2002 23:30:51 +0100 Received: (from mailnull@localhost) by kemoauc.mips.inka.de (8.11.6/8.11.6) id g0VLdIp42446 for freebsd-questions@freebsd.org; Thu, 31 Jan 2002 22:39:18 +0100 (CET) (envelope-from mailnull) From: naddy@mips.inka.de (Christian Weisgerber) Subject: Re: unsigned char portability Date: Thu, 31 Jan 2002 21:39:17 +0000 (UTC) Message-ID: References: Originator: naddy@mips.inka.de (Christian Weisgerber) To: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG June Carey wrote: > I have a question I was hoping someone could answer. > Does the "unsigned char" C type have any machine architecture portability > problems ? For one thing, you don't know its size. I'm told there are C implementations on DSPs and such that have 32-bit chars, simply because those processors don't support other datasizes or byte addressing. Now whether you care about portability to such platforms is a different matter. As far as FreeBSD is concerned, i.e. any platform FreeBSD is likely to be ported to, you can assume an unsigned char to refer to an unsigned 8-bit integer. > I rather suspect the answer is NO, since I seem to recall that "The Design > and Implementation of the 4.4BSD Operating System" book mentions that > bytes/octets are network portable in their native bit-ordering. Just like memory, networks tend to treat the octet as the atomic unit of transmission. Of course you need to worry about bit-ordering any time you serialize an octet, but that is usually handled in hardware. -- Christian "naddy" Weisgerber naddy@mips.inka.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message