2 ms·
(0) True, but the default assumption really should be that the indirection tax is fine. There are plenty of non-realtime C apps. If you're really seeing a slowd
by yawaramin 9y ago
(0) True, but the default assumption really should be that the indirection tax is fine. There are plenty of non-realtime C apps. If you're really seeing a slowdown, then by all means trade off some of that abstraction power.
(1) & (2) You could use conversion functions, no? E.g.:
typedef struct ordering_t* ordering;
typedef struct person_t* person;
typedef struct business_t* business;
ordering ordering_of_person(person);
ordering ordering_of_business(business);
void* sort(void*, ordering);
- catnaroek 9y ago(0) The indirection tax is not fine. I want both nice abstractions and efficient implementations. (1) and (2) Your proposal doesn't work, because different abstract data types are, well, different, even if they expose the same operations. (Perhaps you're confusing “abstract data types” with “abstract classes”?) If you don't believe me, try merging a binomial heap and a pairing heap.