Some more questions

dg@dcs.st-and.ac.uk
Thu, 21 Nov 96 00:02:13 +0000

Some of you may recall that I sent a list of questions to the list some time
ago, to which I got some extremely helpful replies. Since then, I've got a
copy of the SDK and started programming. Unfortunately, I've come across a few
problems, albeit of a slightly more advanced nature than the last lot. I would
be extremely grateful if I could draw upon your combined knowledge
again --- the answers do not appear to be in the SDK manuals (and there is
a *lot* of it...).

1. What is the best way of allocating >64kB of small (few hundred byte)
objects, preferably persistently? Currently, I'm using a Database and
creating everything as ungrouped. This works fine but is deathly slow. I
think this is because I'm locking and unlocking objects extremely
frequently (I don't want to leave anything locked because I might need to
use DBRealloc). If the total amount of memory needed was less than 64kB, I
could use a LMem, but I need to be able to store more than that.

2. How are global and static variables stored? I presume that they're put
in the relevant code resource. But, code resources should be discardable.
If so, are the values of the variables lost? If not, are all code
resources kept loaded all the time? And what happens if they are accessed
from some other code resource? Does the compiler generate the appropriate
code to load it? GOC doesn't appear to produce anything special. I'm
writing a single-launchable application, so I don't need to worry about
which instance of the variable is being accessed.

3. Is there any message that is received when the user interface tree is
built and ready? My program has a window in which various status messages
are displayed. When the program is run, it has to do some initialising,
and I want to tell the user that this is happening. So that the user can
see these messages, I have to wait until the window is ready before
starting. If I don't, initialisation is complete by the time the window is
drawn. Currently, the first time my window's MSG_META_REDRAW is called, it
sends a message back to the process to tell it to start initialising. Not
only is this very nasty, it only works on the EC version. The NC version
doesn't display anything at all.

4. Is there any reason why I can't use the -P option to BCC to tell it to
build in C++ mode? This will let me use some C++ constructs such as //
comments and declaring variables as I need them. This would let me tidy my
code somewhat.

If anyone could help, I would be extremely grateful...

TIA,

------------------- http://www-hons-cs.cs.st-and.ac.uk/~dg --------------------
If you're up against someone more intelligent than you are, do something
totally insane and let him think himself to death. --- Pyanfar Chanur
---------------- Sun-Earther David Daton Given of Lochcarron ------------------