Path: utzoo!attcan!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: Portability and BS Message-ID: <10886@steinmetz.ge.com> Date: 18 May 88 18:29:44 GMT References: <2853@pasteur.Berkeley.Edu> <51436@sun.uucp> <524@wsccs.UUCP> <11530@mimsy.UUCP> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 37 In article <11530@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: | In article <524@wsccs.UUCP> terry@wsccs.UUCP writes: | >Summary: Portabilty and BS | | It was an apt summary: The text (here deleted) had a little to do with | portability, and was mostly BS. In a number of closely spaced further | postings, the same person flamed Sun's SPARC architecture and/or | compilers. The curious thing, to me, is that while terry@wsccs | complains that SPARC makes her or his `portable' code fail, I have | never heard the same from anyone else working with a Sun-4. But | perhaps it is just a coincidence that Terry's `portable' code fails | while everyone else's runs. Without commenting on the original issue (it's getting lost in the heat) I would like to say that Terry is *not* the only person getting in trouble on the Sun4. A number of major machines (VAX, 80x86, 68xxx) lose performance when alignment is not preserved for 2 byte and 4 byte quantities, but they will access the data. My Sun VAR told me that the reason he had to tweak my code was that I had used this in a packed data structure. He was unable to access longs which were not zero mod four. He showed me the diffs and he had unpack and pack with byte moves. The Honeywell L66/68 have a similar 'feature' when accessing 36 vs 72 bit words. Since there is no alignment algorythm which applies in all cases, exchanging binary data requires some assumption, and that is "no alignment.' Any program which manipulated binary data could be subject to problems. Whatever the value of the original posting, and I feel that it is correct to say that the code was not portable, there are a number of people who have been bitten by this and similar side effects. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me