Hello Richard,
There is now some experimental code in NSArray.m in CVS to use the heap for numbers of objects above 1000 (an arbitrary choice).
It uses a couple of new macros which will probably eventually make their way to GSObjCRuntime.h once we've picked better names
and decided on a good number ... perhaps nearer 100.
Because by convention we currently prefer autoreleased objects in GDL2 and GSWeb, we have the need for a version of this macro that uses the GSAutoreleasedBuffer. I've also played with allowing different types, making sure the size is evaluated only once and making the identifiers unique so that you could use multiple buffers in the the same block. Have a look at it and see if we should apply something this to the versions in -base also:
#define GDL2_BUFFER(ID, SIZE, TYPE) \ unsigned ID##_size = (SIZE); \ TYPE ID##_obuf[(ID##_size) <= GS_MAX_OBJECTS_FROM_STACK ? (ID##_size) : 0]; \ TYPE *ID##_base = ((ID##_size) <= GS_MAX_OBJECTS_FROM_STACK) ? ID##_obuf \ : ( TYPE *)GSAutoreleasedBuffer((ID##_size) * sizeof( TYPE )); \ TYPE *ID = ID##_base;
For the non-autorelease version, we may want to consider (optionally ?) adding exception handling to free the buffer if necessary.
Cheers, David
_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep
