Path: utzoo!attcan!uunet!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: C++ for the Mac Message-ID: <8139@hoptoad.uucp> Date: 26 Jul 89 21:25:49 GMT References: <8060@hoptoad.uucp> <669@cbnewsk.ATT.COM> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 48 In article <669@cbnewsk.ATT.COM> ech@cbnewsk.ATT.COM (ned.horvath) writes: >Shucks, Tim, I wrote that part of the Aztec linker, including nonzero >initialization. But when you are talking C++, you ARE talking about >nonzero initialization, and running new() overloads as part of that >initialization. And when you are talking about method-dispatch tables, >you are talking about data initialized from information provided only >by the compiler and effectively usable by the linker alone. I haven't been keeping up with Stroustrup's work lately, and the closest I've ever been to a C++ system was a technical manual, so I don't know whether you're right or not. What is all this initialization used for? The last time I looked, you couldn't use function pointers as initializers in MPW C because they aren't compile-time constants. Method dispatch tables have to be initialized explicitly at run-time if they point to functions. Will the MPW C++ system put out function offset tables or something for initialization? >Yes, I suppose I could ask the MPW linker to create a symbol table, and I >suppose I could write a "post-linker" to put that information into a >resource where my DA's open could find it, and I suppose I might >even be able to track changes in Apple's C++ and MPW naming conventions >and object-file symbol conventions for my own personal use. Or I suppose >I could write my own linker to do it "right." Perhaps you could, too. Assuming that you do need non-zero initialization, then it shouldn't be as hard as this. The linker already puts out tables describing extern initialization in a resource; these tables are traversed by a routine in the C run-time library. There are probably a few tricks involved in putting these pieces together for non-application code resources, but I doubt it would be more than a few days to figure it out -- and once once person figures it out, anyone can use their solution. I didn't bother because I generally prefer my externs and statics to be initialized to zero regardless.... >So I'll rephrase my original statement, thus: unless you are a Maroney- >class guru, and you are prepared to do one shitload of work, you aren't >going to be using virtual methods in non-applications any time soon. That's so sweet. But like I said, I really don't believe it's all that much work for anyone but the first person. It would be nice if Apple would just provide the solution themselves, but they do provide the pieces, anyway. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Satanic is merely the name they give to the behavior of those who would disrupt the orderly way in which men want to live." -- Gabrielle, THE VAMPIRE LESTAT, Anne Rice