Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!rochester!cornell!batcomputer!hsgj From: hsgj@batcomputer.UUCP Newsgroups: comp.sys.amiga Subject: Re: Portable "C" Code Message-ID: <659@batcomputer.tn.cornell.edu> Date: Fri, 10-Apr-87 20:45:58 EST Article-I.D.: batcompu.659 Posted: Fri Apr 10 20:45:58 1987 Date-Received: Sun, 12-Apr-87 00:39:07 EST References: <8704071939.AA09157@cory.Berkeley.EDU> <1102@rpics.RPI.EDU> Reply-To: hsgj@tcgould.tn.cornell.edu.UUCP (Dan Green) Organization: Theory Center, Cornell University, Ithaca NY Lines: 34 In article <1102@rpics.RPI.EDU> guilford@rpics.RPI.EDU (Jim Guilford) writes: >I've read several articles dealing with the incompatibilities between >lattice and manx C-compilers. This may be a naive question, but why is there >such an incompatibility? Isn't the purpose of a High-Level-Language to avoid >such problems. [...good stuff...] >I would think that people writing in C, using the starndard RKM routines >would produce portable code. Is it really that difficult? > >--Jim Guilford >(guilford@csv.rpi.edu) I have never used Amiga Manx so this is written from a Lattice perspective. I think a lot of compatibliity problems are (aside from RKM calling conventions) the difference in the "standard" stdio packages on both compilers. I know that I just finished a routine that had to generate -true- random numbers. On every 4.2BSD cc I have used (under vax750, gould,sequent) the function is called "random()" and it returns an integer from 0 to MAXINT. In Lattice C, a similar function is called "lrand48()" and does the same thing but returns from 0 to MAXLONG. Why the name change? Lattice also didn't like the way some of the string routines were named and called some funny names, like "stccpy" for "strcpy". Before anyone flames, yes they do have a #define strcpy stccpy automatically so you can still use strcpy. Speaking of that, I believe someone said that Manx has the "index" function, while Lattice uses "stptok" to search for a substring. Who is standard? I don't know. But anyways, if your code relies on a lot of these idiosyncratically named functions, then it probably won't port. Note that these are easy to fix with #ifdefs and #defines, but only if you know that the problems exist. One last comment: Please notice that I have avoided compiler wars. Cash rewards accepted... -- Dan Green -- ARPA: hsgj%vax2.ccs.cornell.edu@cu-arpa.cs.cornell.edu UUCP: ihnp4!cornell!batcomputer!hsgj BITNET: hsgj@cornella