Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!husc6!seismo!rochester!kodak!elmgate!jdg From: jdg@elmgate.UUCP (Jeff Gortatowsky) Newsgroups: net.micro.amiga Subject: Re: Orphaned Response Message-ID: <494@elmgate.UUCP> Date: Wed, 9-Jul-86 15:56:59 EDT Article-I.D.: elmgate.494 Posted: Wed Jul 9 15:56:59 1986 Date-Received: Fri, 11-Jul-86 06:06:31 EDT References: <8606161842.AA20107@pavepaws> <26600033@ccvaxa> Organization: Eastman Kodak Co., Rochester, NY Lines: 52 Summary: Size of shorts int and longs In article <26600033@ccvaxa>, aglew@ccvaxa.UUCP writes: > > I've noticed a lot of people talking about shorts and ints and longs, > and whether an int should be 16 or 32 bits, and what the size of a > short should be. > > I've also noticed somebody say that he always uses shorts or longs, > because they always have a definite size. SHAME! Where is it written If it's my message you refer to I guess: A: I mis-stated what I meant. On the Amiga shorts are 16 bit and longs are 32 (yes It's not cast in concrete) but it makes sense and _WORKS_. B: As I state below this assumption is QUITE portable to larger data size machines. C: When I choose a data type I choose the smallest that will hold the expected value of the data. That means shorts for data <65536. It's faster and portable (Blast you megamax!) to 16 bit CPUS or >. > in stone that shorts are 16 bits and longs are 32 bits, and ints one > or the other? What if you have a machine that supports 64 bit integers > in hardware - wouldn't it be natural to have shorts 16 bits, ints 32 bits, > and longs 64 bits? Sure it would be! - but you can't do the sensible > thing because of all sorts of brain-damaged non-portable programs that > assume an int is the same thing as a long, 32 bits worth. Which leads > to abominations like long longs, etc. > > This is what is going to kill C - not Ada, just the accumulation of > implicit machine dependencies. > > Andy "Krazy" Glew. Gould CSD-Urbana. USEnet: ihnp4!uiucdcs!ccvaxa!aglew > 1101 E. University, Urbana, IL 61801 ARPAnet: aglew@gswd-vms I don't know if it was me your refering to as using longs and shorts only, but thats about what I do. Your point about 64 bit machines doesn't apply. I don't assume anything except that ints are non-portable, period. If shorts are 16 or 32 bits on a 64 bit machine, my code works. Further on a restricted bus machines (like 68000 and 68010 or a 64 bit CPU on a 32 bit bus) my coding practice is a big win. If longs are 32 bits or 64 bits my code works. Can you say the same for ints? I think we are on the same side. I don't assume anything about the SIZE of a data type. But I do assume shorts and longs will be upward (size wise) compatible. BTW Longs would(should) be 64 bits, not long longs (gimme a break 8-)). double long? Nah.... -- Jeff Gortatowsky {allegra,seismo}!rochester!kodak!elmgate!jdg Eastman Kodak Company