Xref: utzoo comp.arch:13744 comp.lang.c:25831 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!chinacat!sequoia!rpp386!woody From: woody@rpp386.cactus.org (Woodrow Baker) Newsgroups: comp.arch,comp.lang.c Subject: Re: RISC Machine Data Structure Word Alignment Problems? Summary: data alignment Keywords: risc sun Message-ID: <17906@rpp386.cactus.org> Date: 11 Feb 90 05:34:11 GMT References: <111@melpar.UUCP> <1990Jan21.224826.1699@esegue.segue.boston.ma.us> <328@ctycal.UUCP> Organization: River Parishes Programming, Plano, TX Lines: 27 In article <328@ctycal.UUCP>, ingoldsb@ctycal.UUCP (Terry Ingoldsby) writes: > In article <1648@skye.ed.ac.uk>, richard@aiai.ed.ac.uk (Richard Tobin) writes: > This discussion, IMHO, is pointless. The C compilers work just fine the way > are (or at least the ones I am familiar with). I don't think some of the > people discussing this realize the implications of what they propose. Wrong. It depends on what you do. I happen to do programming dealing with industrial controllers. Specificaly, I maintain a compiler, editor downloader, and monitor package used to program Eagle Signal Controls EPTAK series industrial controllers. The code that I work on runs under MS-DOS. I have to do things like reach out over the network, and read data structures out of the remote controllers. These structures for the most part, are a mix of byte and word fields. I then have to parse through them, and isolate the parts. Structures are the obvious way to do this. BUT, the @#$% compiler choses to pad byte or char values out to ints. This, obviously screws up the data structure access to the retrieved values. I have wound up doing things that I am not proud of, like unions, monkeying around with pointers to the structures such that they don't point to where they should, but to some offset other than the first byte of the structure etc. Yes, I could chose to use an array, but it is clearer to use standard field names, (at least standard for the EPTAK controlers) to access these data fields. Cheers Woody