Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.16 $; site datacube.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!bbnccv!datacube!berger From: berger@datacube.UUCP Newsgroups: net.lang.c Subject: Re: Re: Re: Uses of \"short\" ? Message-ID: <7800003@datacube.UUCP> Date: Tue, 15-Oct-85 19:10:00 EDT Article-I.D.: datacube.7800003 Posted: Tue Oct 15 19:10:00 1985 Date-Received: Fri, 18-Oct-85 01:30:32 EDT References: <2081@brl-tgr.UUCP> Lines: 28 Nf-ID: #R:brl-tgr:-208100:datacube:7800003:000:769 Nf-From: datacube!berger Oct 15 19:10:00 1985 The main use would be when you create structures that describe the layout of registers in hardware. In otherwords, when you are writing a driver or something you might say: struct deviceRegs { int8 csr0; int8 csr1; int16 dataport; }; register struct deviceRegs *p = (struct deviceRegs *)0x40000; p->csr0 = 0xff; etc. You want each structure element to be a particular size so you can access particular 8 bit bytes or 16 bit words. This does not protect you from byte swapping and I suspect some compilers might throw in hidden alignments, but in general it works and looks nice. Bob Berger Datacube Inc. 4 Dearborn Rd. Peabody, Ma 01960 617-535-6644 ihnp4!datacube!berger decvax!cca!mirror!datacube!berger {mit-eddie,cyb0vax}!mirror!datacube!berger