Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ted From: ted@cs.utexas.edu (Ted Woodward) Newsgroups: comp.sys.mac.programmer Subject: Re: global data in Think C Message-ID: <709@earth.cs.utexas.edu> Date: 7 May 90 21:09:10 GMT References: <2568@crash.cts.com> Organization: U. Texas CS Dept., Austin, Texas Lines: 43 This is in response to everyone criticizing my programming style for having 47K of globals, etc etc. Well, I'm doing a port of moria from MPW C to Think C. This isn't my code. I've already put 10K of globals into dynamically allocated space, and the other 47K is either library globals (ANSI has 3K, etc), strings, or static variables. That's right, Think C puts static variables into global space. So, please, don't criticize me for using 47K of globals. If you had actually looked at what I was trying to do, I was trying to put global strings into the help, something I wouldn't try to do unless I had already put lots of other stuff into the heap (easier stuff, like big arrays...) To the people who sent me mail suggesting I check the strings as STRs, thank you. I'll try it when I get home tonight. Now, as to what I wanted to do when I said I wanted to assign cstrings to Str32's in the heap: You can say char *temp = {"dslkfsdf","lkjasflkds","lkdsflsdf"}; and get an array of strings. I want to be able to do this at runtime, to say: char *temp; main() { temp = {"asl0kjsaf", "askfjasjf","asl0kfja;0kjf"}; } and be able to reference them by temp[2], etc...so what I decided to do is create an array of *Str32. then reference each string as temp[3], like above...I really don't care about wasted space, as long as it's in the heap. And this will be done at the beginning of the program, so fragmentation is not a problem. And I don't really feel like making this a handle, because they are a pain, and this won't need to be relocated (above sentence). (Geez, am I being incoherent, or what?) Anyway, I'll try just checking the STR option...hopefully, moria 5.1.4 for the mac will be done tonight... (Thanks, Jim) -- Ted Woodward (ted@cs.utexas.edu) Death now has Extra Speed!