Re:The Power of Ten – Rules for Developing Safety Critical Code
by hackits on Thursday July 14, 2016 @09:09AM
(#12093393)
My take on it is. If have a task that can only allocate `once` a area of memory for initialization, then you can use the allocation size to put a constraint on the iterators based on the datatype size.
eg...
const size_t taskSize = 256;
const Task *task = (Task*) malloc(taskSize);
zeroMemory(task,taskSize);
// Allocate array of int's
int *intPtr = (int*)(task);
int intSize = taskSize+4;
for (int i=0; i<intSize && i<(taskSize/sizeof(int)); i++)
{
// do stuff.
}
eg...