December 01, 2003
Efficient Variable Automatic BuffersMatthew Wilson
In this article, Matthew presents auto_buffera simple, platform-independent STLSoft template class that fulfills dynamically sized allocations from encapsulated arrays.
Listing 1: Variable variants.
static const char *m1[] = "static";
void func1(size_t index)
{
char m2[4097] = "";
char *m3 = (char*)malloc(4097);
m2[index] = '\0';
m3[index] = '\0';
free(m3);
}
|
|
||||||||||||||||||||||||||||
|
|
|
|