”… why…do something silly like that”
It’s not me, the library works like this:
struct _host { int status; str name; }; typedef struct _host host; void host_free(host *); host host_copy(host *); #define T host // <- custom type #include <deq.h> // functions to implement void host_free(host *h) { str_free(&h->name); } host host_copy(host *h) { host _ = *h; _.name = str_copy(&h->name); return _; }
The library then provides:
container_type_push_back container_type_pop_back container_type_push_front container_type_pop_front
…and some more, depending on the container.
If the container is a deq (dequeue) and its type named fubar this would result in deq_fubar_push_back and so on. Instead of a simple push in a well know post-modern language. One may regret this but it is like it is. And I don't know how else to do it. Apart from the fact that I can't write such macros.
Other libraries, like m*lib work similiar - m*lib does this excessively.
In reply to Re^4: OT: Why does malloc always give me 24?
by karlgoethebier
in thread OT: Why does malloc always give me 24? [SOLVED]
by karlgoethebier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |