From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,76b1fcc14e8dced X-Google-Attributes: gid10f6aa,public X-Google-Thread: 109fba,76b1fcc14e8dced X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,8b6c45fbebd7d3b7 X-Google-Attributes: gid1014db,public X-Google-Thread: 114917,76b1fcc14e8dced X-Google-Attributes: gid114917,public X-Google-Thread: 103376,c9c309a1859318a1 X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: HELP ! need to insert value in array !! Date: 1997/07/04 Message-ID: <5pht85$d4o$1@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 254536595 References: <33A9C27C.22F7@post4.tele.dk> <5oci49$97g@crl.crl.com> <866920621snz@genesis.demon.co.uk> <5p0v7l$9uc@nntp.seflin.org> <33b64c2f.43589878@nntp.ix.netcom.com> Organization: Comp Sci, RMIT University, Melbourne, Australia. Newsgroups: comp.lang.c,comp.lang.c++,comp.os.msdos.programmer,comp.lang.asm.x86,comp.lang.ada NNTP-Posting-User: ok Date: 1997-07-04T00:00:00+00:00 List-Id: dewar@merv.cs.nyu.edu (Robert Dewar) writes: >What would one expect on a PDP10 with 5 characters per word and an unused >bit left over, or does the ANSI C standard require 36 bits/character on >this machine? UCHAR_MAX must be at least 255. All objects in C must have a size that is a multiple of the size of a byte, and since we'd expect 36-bit int and float on a PDP-11, that means the size of a "byte" has to be a factor of 36 that is greater than or equal to 8. That means the possible sizes for a char in a PDP-10 implementation of C are 9 bits (4 per word) 18 bits (2 per word) 36 bits (1 per word) I've actually used the Snyder C compiler for the PDP-10, but I can't remember what it did. I'm pretty sure it wasn't 9 bits per char. Note that 5 ASCII characters per word was a software convention; for C programs to inter-operate with other code, you'd need to convert, but then for things like opening files you'd need to convert to _six bit_ characters. >suppose that type T is a struct with a double field and an int field. >The size of this struct would be 12 bytes, but its alignment requirement >is 8, so it would not be possible to laout the array b without alignment >gaps??? The point is that the size of an _isolated_ variable of type T must be exactly the same as the size of an _array element_ of type T. Yes, there would be padding in your type T, but it would be in _all_ variables of that type, not just ones in an array. (You could think of every object in C being an element of a one-element array, and with respect to pointer arithmetic, that model would not mislead you.) -- Four policemen playing jazz on an up escalator in the railway station. Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.