From: XXguille AT XXiies DOT XXes (Guillermo Rodriguez Garcia) Newsgroups: comp.os.msdos.djgpp Subject: Re: Portability and size_t type related question Date: Thu, 13 May 1999 21:59:17 GMT Organization: Telefonica Transmision de Datos Lines: 40 Message-ID: <373db8ea.1455063@noticias.iies.es> References: <373b1a09 DOT 3346354 AT noticias DOT iies DOT es> NNTP-Posting-Host: iies249.iies.es Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Forte Agent 1.5/32.451 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com El día Thu, 13 May 1999 11:12:26 GMT, XXguille AT XXiies DOT XXes (Guillermo Rodriguez Garcia) escribió: >>> Like 'char' is always 1 byte. >> >>That's not true, either. There are compilers (mostly for embedded >>systems) where `char' is 32-bit wide. > >Then a byte is defined as 32 bits on those systems. You see, a byte is >not always 8 bits. It may be 4-bit wide, or 7-bit, or whatever. The >exact definition of byte, for every system, is the minimum addressable >memory unit. Quoting from "Rationale for American National Standard for Information Systems - Programming Language - C" (the ANSI C rationale is a document which explain and tries to clarify the standard itself): "All objects in C must be representable as a contiguous sequence of bytes, each of which is at least 8 bits wide. A char (or signed char or unsigned char) occupies exactly one byte. (Thus, for instance, on a machine with 36-bit 'words', a 'byte' can be defined to consist of 9, 12, 18 or 36 bits, these numbers being all the exact divisors of 36 which are not less than 8.) These strictures codify the widespread presumption that any object can be treated as an array of characters, the size of which is given by the sizeof operator with that object's type as it operand." What I said above is also true: a byte can be any width, depending on the system; but for a conforming C implementation, the host machine must have at least 8 bits per byte. Regards, GUILLE ---- Guillermo Rodriguez Garcia XXguille AT XXiies DOT XXes (ya sabes :-)