Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c Subject: Re: HARRIS FLAME Re: SHORT vs. INT Message-ID: <2803@sun.uucp> Date: Mon, 16-Sep-85 02:42:38 EDT Article-I.D.: sun.2803 Posted: Mon Sep 16 02:42:38 1985 Date-Received: Wed, 18-Sep-85 03:13:10 EDT References: <1390@brl-tgr.ARPA> <2778@sun.uucp> <519@lasspvax.UUCP> Organization: Sun Microsystems, Inc. Lines: 46 > >People who use the C language should be sufficiently expert that they > >understand that "long" and "short" should not be selected in favor of "int" > >only if they are of different sizes on the machine you're coding on. > > But I can't quite fiqure out what you mean here. Does it mean that is > if 'short' 'int' and 'long' are the same size then I should choose > something other than 'int'? You did figure out what I meant - that is exactly what I mean! If you want to have a variable that can hold values outside the range -32767 to 32767, use "long", regardless of whether something else just might happen to work. It won't work on other machines, and unless you can guarantee that the code will *never* be run on another machine, you shouldn't do it. > Some of us have not been formally trained to program in C. > Some of us, out of curiosity, desire to use something "better" than > fortran, or other reason, have taught ourselves C by reading K&R and > writing programs. Too many postings here indicate that the poster skipped the "reading K&R" part or didn't read it very well. > Some of us are not able to devote all our time to working with > computers because we have other professions. Presumably, a physicist building a piece of electronic equipment will have learned enough about electronics not to put 110V across a microprocessor chip. Somebody using C (or any other language) for, say, a program in a physics experiment should have learned enough to know the basics of portability, and of pointer use, and... > Some of us do not have access to more than one machine and thus, though > we'd like to write portably, have know way of experimantally finding out > what is and is not portable. You don't find out what's portable by experimenting. You find out by reading something like Harbison and Steele's "C: A Reference Manual". All experimenting will do is indicate whether something will work on the machines you happen to have at hand. What I'm saying is that some questions - and FAR too many answers - seem to be posted before the poster has checked any references, or read K&R, or otherwise done a bit of legwork themselves. Guy Harris