Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!ius2.cs.cmu.edu!edw From: edw@ius2.cs.cmu.edu (Eddie Wyatt) Newsgroups: comp.lang.c Subject: Re: Standard int sizes Message-ID: <1098@ius2.cs.cmu.edu> Date: Sun, 12-Apr-87 14:36:24 EST Article-I.D.: ius2.1098 Posted: Sun Apr 12 14:36:24 1987 Date-Received: Sun, 19-Apr-87 09:37:05 EST References: <6759@brl-adm.ARPA> <230@ems.UUCP> <170@vianet.UUCP> <5744@brl-smoke.ARPA> Organization: Carnegie-Mellon University, CS/RI Lines: 38 In article <5744@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > In article <170@vianet.UUCP> devine@vianet.UUCP (Bob Devine) writes: > > ... That is, if you need a 16 bit arithmetic type, use: > > > > If "machine has compiler that uses 16 bits for 'short'" > > #define int16 short > > > > If "machine has compiler that uses 16 bits for 'int'" > > #define int16 int > > If you simply need at least 16 bits in a signed integer data type, > use "short". That way whoever reads the code doesn't have to learn > what your invention "int16" means. For one, the mnemonics to int16 are clear - A data object of at least 16 bits. Second and most important - shorts are NOT guaranteed to be 16 bits. Someone else correct me if I am wrong but you are only guaranteed: sizeof(short) <= sizeof(int) <= sizeof(long). And there C implentations that use another size for short other than 16 bits (2 bytes). -- Eddie Wyatt They say there are strangers, who threaten us In our immigrants and infidels They say there is strangeness, too dangerous In our theatres and bookstore shelves Those who know what's best for us- Must rise and save us from ourselves Quick to judge ... Quick to anger ... Slow to understand... Ignorance and prejudice and fear [all] Walk hand in hand. - RUSH