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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, PLING_QUERY 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: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public From: Dan.Pop@cern.ch (Dan Pop) Subject: Re: How big is an int? (was: Yet another stupid language war (was: ... the only languages you need!!)) Date: 1997/11/08 Message-ID: #1/1 X-Deja-AN: 287988062 Sender: news@news.cern.ch (USENET News System) References: <345F49A2.5F5DC5A0@aom.ericsson.se> <63oadj$ljc$1@helios.crest.nt.com> <63se05$bgu$1@news.nyu.edu> X-Nntp-Posting-Host: ues5.cern.ch Organization: CERN European Lab for Particle Physics Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1997-11-08T00:00:00+00:00 List-Id: In ppearson@nospam.hiwaay.net (Paul F. Pearson) writes: >Am I remembering correctly that ANSI C states the the sizeof(short) must >tbe the sizeof (char)? ANSI C makes no statement whatsoever about sizeof(short). The ONLY type on whose size the standard imposes a restriction is char. The standard guarantees that sizeof(char) == 1. It is theoretically possible to have an implementation with sizeof(long) < sizeof(int) < sizeof(short), but even on that implementation you must have SHRT_MAX <= INT_MAX <= LONG_MAX (otherwise the integral promotion rules would stop working), so the types short and int would make a very inefficient use of their allocated space. Dan -- Dan Pop CERN, IT Division Email: Dan.Pop@cern.ch Mail: CERN - PPE, Bat. 31 1-014, CH-1211 Geneve 23, Switzerland