miket@ccicpg.UUCP (Mike Tracy) (01/29/88)
In article <6240@sol.ARPA> crowl@cs.rochester.edu (Lawrence Crowl) writes: >Since I've noticed some confusion on the C "int" datatypes, I thought I would >post a clarification. The "int" datatypes are not integers, they are machine >"words". (Please excuse typos - some keys on this #1$&?@ keyboard don't always work) I'll have to disagree with you. Many machines use a 16 bit word while an 'int' is (many times) 32 bits. It has more to do with the natural size of objects that the system manipulates. example: if your machine "likes" to add together 32 bit numbers than, most likely, an int is 32 bits. An 'int' reflects more of what is 'optimum' for the machine's cpu, bus, etc. to handle, not word size. I do agree that mixing bytes and ints, etc. can be lead to problems with non-portable code. -- Michael D. Tracy Computer Consoles Incorporated (714)458-7282 9801 Muirlands Boulevard Irvine, CA 92718 {allegra!hplabs!felix,seismo!rlgvax}!ccicpg!miket
crowl@cs.rochester.edu (Lawrence Crowl) (01/30/88)
In article <10179@ccicpg.UUCP> miket@ccicpg.UUCP (Mike Tracy) writes: >In article <6240@sol.ARPA> crowl@cs.rochester.edu (Lawrence Crowl) writes: >>Since I've noticed some confusion on the C "int" datatypes, I thought I would >>post a clarification. The "int" datatypes are not integers, they are machine >>"words". > >I'll have to disagree with you. Many machines use a 16 bit word while an >'int' is (many times) 32 bits. It has more to do with the natural size >of objects that the system manipulates. ... You have just confirmed my statement. The fact that some C compilers use a word size that is not identical to the bus size of the machine is irrelavent to the point I was making. The crucial difference is this: is the datatype supporting the machine, or is it supporting an abstraction. In C, "int" supports the machine instead of supporting an abstraction. To see this, note that the & operator is meaningless for integers, but not for machine words. The C support for & indicates that it is oriented towards machine words and not towards the integer abstraction. Note that the second you start defining C semantics in terms of bits, you have oriented yourself towards machine words. -- Lawrence Crowl 716-275-9499 University of Rochester crowl@cs.rochester.edu Computer Science Department ...!{allegra,decvax,rutgers}!rochester!crowl Rochester, New York, 14627