Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!mailrus!tut.cis.ohio-state.edu!bloom-beacon!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Absolute size of 'short' Summary: No need to introduce new syntax Message-ID: <6938@haddock.ima.isc.com> Date: 2 Sep 88 20:36:17 GMT References: <214@ISIDAPS5.UUCP> <9641@dartvax.Dartmouth.EDU> <62505@sun.uucp> <625@proxftl.UUCP> <1382@ficc.uu.net> <678@proxftl.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 19 People have suggested that some notation like `int:9 foo' should exist, which declaration would reserve two bytes on a Vax, but only one on a Honeywell. I will again point out that it is already possible to do this within the current language, via a header file "ints.h". On a PDP-11, it would contain: typedef char int_1, int_2, int_3, int_4, int_5, int_6, int_7, int_8; typedef short int_9, int_10, /*...*/, int_16; typedef long int_17, /*...*/, int_32; typedef unsigned char uint_1, /*...*/, uint_8; typedef unsigned short uint_9, /*...*/, uint_16; typedef unsigned long uint_17, /*...*/, uint_32; Using the constants in ANSI C's , one could even write a universal implementation of "ints.h" which is portable to all machines (given an upper limit on the number of bits being supported). (One admitted flaw: the bitwidth must be specified directly in this scheme; you can't compute it at compile-time.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint