Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!gatech!bloom-beacon!think!!ephraim From: ephraim@.COM (Ephraim Vishniac) Newsgroups: comp.sys.mac.programmer Subject: Re: Compiling trouble with Think's LSC Message-ID: <25540@news.Think.COM> Date: 27 Jul 89 16:54:27 GMT References: <1814@eds.ericsson.se> Sender: news@Think.COM Reply-To: ephraim@think.com (Ephraim Vishniac) Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 32 In article <1814@eds.ericsson.se> rif_xu@eds.ericsson.se writes: >/* > I'm having some troubles with Think's LSC: > > a) The program below,which sorts primes out, doesn't give > correct results - it even pops out some even numbers ! - > when compiled using TLSC 3.01p4. I used the '020 setting > and used the MacTraps and the Stdio libs. Includes was > of course. [more comments deleted] >/* > * Virtual sieve to find primes. Requires only O(sqrt(N)) space to > * find primes up to N. > * > * WARNING: This code assumes that ints are 32 bits As noted in the manual, LSC assumes that ints are 16 bits. So, you lose this one. The moral is that portable programs should *never* say "int" but should always say "short" or "long". In MPW and on the VAX, ints are 32 bits. That's why they give different results than LSC in this case. Enough verbiage yet? Our news software has the fascist line-counter feature to stop you from follow-ups without enough new material. Ephraim Vishniac ephraim@think.com ThinkingCorp@applelink.apple.com Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142 One of the flaws in the anarchic bopper society was the ease with which such crazed rumors could spread.