Btw, I want to explicitely 'hide' my structure.
Let say I have a structure:
and a typedef:Code:typedef struct { void *base; unsigned short initialSize; unsigned short increment; unsigned int allocated; unsigned int elementSize; } _MEMORY_POOL, *_PMEMORY_POOL;
Code:typedef void *MEMORY_POOL;Is it a good idea to do something like this?Code:void *_pcheck(MEMORY_POOL p, unsigned int offset) { if(offset >= ((_PMEMORY_POOL)p)->allocated) if((((_PMEMORY_POOL)p)->base = realloc(((_PMEMORY_POOL)p)->base, (((_PMEMORY_POOL)p)->allocated = ++((_PMEMORY_POOL)p)->increment * ((_PMEMORY_POOL)p)->initialSize) * ((_PMEMORY_POOL)p)->elementSize)) == NULL) abort(); return ((_PMEMORY_POOL)p)->base; }


