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: 109fba,4873305131bf4d94 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public From: James Youngman Subject: Re: Porting Experiences (was Ada and Pascal etc ) Date: 1997/11/05 Message-ID: #1/1 X-Deja-AN: 287156340 Sender: james@XENON References: <345E3ACD.A15@gsg.eds.com> <878648818snz@genesis.demon.co.uk> <345F9728.D61@gsg.eds.com> To: smetz@gsg.eds.com Organization: VG Gas Analysis Systems Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1997-11-05T00:00:00+00:00 List-Id: >>>>> "Shmuel" == Shmuel (Seymour J ) Metz writes: Shmuel> Lawrence Kirby wrote: >> 1. If the range is contained within -32767 to 32767 then you use >> int >> >> 2. If the range is contained within -2147483647 to 2147483647 >> then you use long. >> >> 3. If you want to minimise space usage (such as for array >> elements or structure members) and the range is contained within >> -32767 to 32767 then you can use short. For -127 to 127 you can >> use signed char. >> >> 4. The unsigned types have larger positive ranges if your range >> is non-negative. Notably unsigned char typically corresponds to >> the notion of "byte" in most languages. Shmuel> Those rules only apply if you are going from one 32-bit Shmuel> machine to another; they have nothing to do with the Shmuel> definition of C itself and are inapplicable when you have to Shmuel> move between different word sizes. No, Lawrence is right; refer to page 257 of Kernighan and Ritchie 2ed (section B11, "Implementation-defined Limits: and ", or section [mumble] of the actual standard document.