Path: utzoo!attcan!uunet!wuarchive!julius.cs.uiuc.edu!apple!lsr From: lsr@Apple.COM (Larry Rosenstein) Newsgroups: comp.sys.mac.programmer Subject: Re: C++/MacApp questions Message-ID: <10486@goofy.Apple.COM> Date: 27 Sep 90 23:47:52 GMT References: <10594@pt.cs.cmu.edu> Organization: Apple Computer, Inc. Lines: 69 mkb@rover.ri.cmu.edu (Mike Blackwell) writes: >Is there ANY way to speed things along besides turning on the RAM disk >cache? It looks like most of the time is spent in CFront processing all >those .h files. Will the dump/load mechanism work here, and if so, can you There is a dump-load mechanism for C++. But that version of C++ is currently only available on the ETO CD-ROM. The MacApp make files support dump/load (for the MacApp headers) automatically. Another way to speed up compiles is to put the temporary files on a RAM disk. C++ really consists of 2 parts. CFront converts the C++ code into C, and the MPW C compiler compiles it. Putting the intermediate file on a RAM disk can make things go faster. (Take a look at the CPlus script; I think there is a shell variable that indicates where to put the temp files.) >Why oh why can't I compile in the background? I have gobs of real memory, MPW 3.x does compile in the background. Another feature of C++ 3.1b4 is that it will use MultiFinder temporary memory, which means you can set the MPW Shell partition size to a smaller number (e.g. 2500-3000K) and still be able to compile large programs when necessary. This doesn't mean C++ will take less RAM. It does mean that the available RAM will be better utilized. (If you aren't using C++, for example, the RAM isn't premanently assigned to MPW.) >A basic C++ question: I'd like to define some class specific constants >inside the class - it makes sense, and develop_2 C++ style guide tells me >it's a good idea. But how? The obvious way (to me) doesn't work: There are 2 ways, depending on your situation: (1) static data member: class TFoo { static const short kMyConst; ... }; In a .c file you need to write: const TFoo::kMyConst = 42; This is contant only in that C++ won't let you change it. The compiler won't be able to evaluate it at compile-time, in most (if not all) cases. (2) use an enum: class TBar { enum {kMyConst=42}; ... }; This will be a constant constant. You can also give the enum a type name, and use that type. You would refer to the type as TBar::. -- Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr -- Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr