Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Portability and BS Message-ID: <11530@mimsy.UUCP> Date: 17 May 88 10:43:59 GMT References: <2853@pasteur.Berkeley.Edu> <51436@sun.uucp> <524@wsccs.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 39 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. There may be (and probably are) bugs in the Sun-4 compilers that are now available. There are enough bugs in those supposedly stable, and much longer tested, 4BSD and AT&T SysV compilers, that I would be very surprised if no one ever found a bug in Sun's SPARC compilers. The bugs, though, are likely to be in little-used corners in the compiler: things like `double d; ... d *= d == 3.14;'. Terry complains about other things: things like variable argument lists and structure padding, things that have never been guaranteed anywhere. Code is made portable by virtue of not assuming those things that are not guaranteed. If you write code using variable argument lists and do not stick to (or, now, ), your code is by definition not portable. In one of those other articles Terry says something that amounts to `my code runs on many machines, therefore it is portable'. It is not so. An example can only disprove portability: if some code fails on a conforming system, that code is *not* portable. If the code runs, that tells you only that any constraints the code may violate are not important on that system. It is just like saying `2 is even; 8 is even; 6 is even; 24 is even; aha, all whole number are even.' One counterexample disproves it: `7 is not even: not all whole numbers are even.' Terry's code does not run on a Sun-4. Unless the Sun-4 does not conform to K&R (or perhaps the dpANS), that means Terry's code is not portable. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris