, ; , - , "" . malloc() , .
, , , , . .
- :
void work(int n)
{
int data[n];
data[0] = 0;
}
- :
#include "vla-tracking.h"
void work(int n)
{
VLA_NEW(int, data, n);
VLA_SET(data, 0, 0);
}
Then create the appropriate macro definitions (and helper code) to track access. As I said, it will be ugly. Of course, the idea is that macros can only “compile” simple definitions controlled by some build time settings (debug / release mode or something else).
source
share