Static allocation of opaque data types

You can use the _alloca function. I believe that it’s not exactly Standard, but as far as I know, nearly all common compilers implement it. When you use it as a default argument, it allocates off the caller’s stack. // Header typedef struct {} something; int get_size(); something* create_something(void* mem); // Usage handle* ptr = … Read more

What is an opaque pointer in C?

An opaque pointer is one in which no details are revealed of the underlying data (from a dictionary definition: opaque: adjective; not able to be seen through; not transparent). For example, you may declare in a header file (this is from some of my actual code): typedef struct pmpi_s *pmpi; which declares a type pmpi … Read more