home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!ficc!peter
- From: peter@ferranti.com (peter da silva)
- Newsgroups: comp.arch
- Subject: Re: 32 => 64 Transition
- Message-ID: <id.UHAS.9TA@ferranti.com>
- Date: 12 Aug 92 14:46:45 GMT
- References: <340@moene.indiv.nluug.nl> <1992Aug08.165832.114442@cs.cmu.edu> <1992Aug11.125326.16719@email.tuwien.ac.at>
- Reply-To: peter@ferranti.com (Peter da Silva)
- Organization: Xenix Support, FICC
- Lines: 56
-
- In article <1992Aug08.165832.114442@cs.cmu.edu>, lindsay+@cs.cmu.edu (Donald Lindsay) writes:
- > [DEC] 32-bit system 64-bit system
-
- > char 8 8
- > short 16 16
- > int 32 32
- > long 32 64
- > long long to be added 64
- > pointer 32 64
-
- I applaud these choices. With them all normal integer sizes remain available,
- and no valid code will be broken.
-
- In article <1992Aug11.125326.16719@email.tuwien.ac.at> anton@mips.complang.tuwien.ac.at (Anton Martin Ertl) writes:
- > I find these choices bad. IMO the relations between types should be
- > preserved. Specifically, pointers and ints should have the same size.
-
- But pointers and ints *aren't* the same size. Look:
-
- + cat test.c
- #include <stdio.h>
-
- main()
- {
- printf("sizeof (int) = %d\n", sizeof (int));
- printf("sizeof (char *) = %d\n", sizeof (char *));
- }
- + cc -Ms -o testsmall test.c
- test.c
- + cc -Ml -o testlarge test.c
- test.c
- + testsmall
- sizeof (int) = 2
- sizeof (char *) = 2
- + testlarge
- sizeof (int) = 2
- sizeof (char *) = 4
-
- > Well-written programs hide dependencies on type sizes by defining
- > types like Int32. They read machine-independent data from files by
- > using XDR or sgetl or ASCII data anyway.
-
- Well written programs don't assume that sizeof (int) == sizeof (char *).
- This is the classic vaxocentric coding error. It's caused me untold grief
- over the past 5 years, and will cause untold grief for other programmers
- over the next 5. It's a pity that 64-bit machines will only exacerbate the
- infamous "infinite VM" fallacy, though.
-
- What size would *you* make an int? 64 bits? What do you do for a 32-bit
- data type? Short? Then what do you do for a 16-bit data type? Create another
- abomination "short short" or "long char"? "long long" is bad enough.
- --
- Peter da Silva `-_-'
- $ EDIT/TECO LOVE 'U`
- %TECO-W-OLDJOKE Not war? Have you hugged your wolf today?
- Ferranti Intl. Ctls. Corp. Sugar Land, TX 77487-5012 +1 713 274 5180
-