Path: utzoo!attcan!uunet!mcvax!guido From: guido@cwi.nl (Guido van Rossum) Newsgroups: comp.sys.mac.programmer Subject: Re: Getting started in Mac programming... Message-ID: <321@piring.cwi.nl> Date: 17 May 88 10:51:51 GMT References: <1911@rayssdb.ray.com> <2586@polyslo.UUCP> Reply-To: guido@cwi.nl (Guido van Rossum) Organization: The Royal Society for Prevention of Cruelty to Amoebae Lines: 65 In article <2586@polyslo.UUCP> dorourke@polyslo.UUCP (David O'Rourke) writes: >In article <1911@rayssdb.ray.com> dwh@rayssdb.ray.com (David W. Humphrey) writes: >> Can someone please offer an experienced Mac user and a budding Mac >> programmer some sound advice as to how to get started in Mac pro- >> gramming? I have a 512Ke, but am considering selling it and getting >> an SE or a II. By what I've read, I think MPW seems like the best >> thing to buy, but I see that a lot of people use Lightspeed C. > > MPW, Yeah!!!! I'd like to make a comparison between LightspeedC (LSC) and MPW. I have used MPW much longer than LSC, and am convinced that it generates better code, has a much more intelligent linker, and a much more powerful programming environment. Especially if you're used to Unix programming, MPW makes the transition easy (you can write Makefiles and shell scripts, albeit with lots of minor changes in the notation). It is also particularly easy to port all sorts of tools that were written for use under Unix. Often no changes are needed. For Mac hackers, MPW's resource compiler and decompiler (rez/derez) are superior to what LSC offers (I think 2.11 came with a prehistoric version of RMaker). However, LSC also has its advantages. The compiler and linker are so much faster than MPW's that program development time shrinks enormously, especially if you're working on a small machine (1 Megabyte, 2 800K floppies, or even a 20Meg HD). In general the exclusion of certain features and deliberate lack in flexibility have made it a remarkably fast system; you can enter LSC, run your application and return to LSC in the time MPW needs to execute the startup file... I plan to do my future code development under LSC, while generating production versions with MPW. Because of the better optimizer (automatic register allocation, for one!) and smarter linker (removes unused functions, not just unused files), MPW applications are easily 20% smaller than those generated with LSC. Unfortunately you have to make a conscious decision to use both MPW and LSC with the same sources. There are many differences, and porting a program written for one to the other may cause you many headaches. Some language differences I've observed (in LSC 2.11, vs. MPW 2.02): int==short in LSC, int==long in MPW names of standard headers differ, e.g. in MPW, in LSC toolbox routines require Pascal strings in LSC, C strings in MPW Points passed by value to toolbox in LSC, by address in MPW MPW defines '\n' == '\r'; in LSC, stdio translates between '\n' and '\r' LSC's library contains more unix emulation functions LSC does strict type checks on pointer assignments, MPW doesn't care LSC doesn't allow "benign" redefinition of preprocessor symbols LSC needs glue to call pascal functions given as function pointers LSC doesn't automatically dereference function pointers in call contexts LSC preprocessor doesn't define __LINE__ and __FILE__ macros LSC has no equivalents of Unix -D and -I compiler options LSC has CtoPstr and PtoCstr, where MPW has c2pstr and p2cstr in LSC, the difference between two pointers is a long! It is possible to program around all of these using a few simple macros; however, if you didn't plan this you'll have a hard time, especially in finding all the incompatible toolbox calls. As far as I know, neither system has much debugging support beyonde generating symbols for Macsbug. -- Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam guido@piring.cwi.nl or mcvax!piring!guido or guido%piring.cwi.nl@uunet.uu.net