by jepler · 10y ago · 0 comments
The main alternative, other than hardcoding an element type, is to use macros and pass the element type in the definition.
Sometimes you just don't have the option of a C++ compiler. Also, and this was a situation I was in recently, I needed a collection in a small area of my C code so it really didn't warrant a toolset change.
typedef struct Strref_t {
char* str;
size_t ref;
} Strref;
There, just pass a pointer of that type around.Does that mean that if you're running as 32bit and want to store a number larger than that (a double or int64_t or so) or a POD that all of these have to be allocated seperately?