Open jengelh opened 3 years ago
@jengelh what do you propose here as the solution?
I've ruled out
Off the top of my head, two options. A forward declaration of an incomplete struct is common:
struct libpff_file;
extern int file_get_item(struct libpff_file *x, int itmidx);
Alternatively, one could wrap intptr into a struct. Since both have the same size, passing the entire struct as an argument shouldn't incur any extra cost.
struct libpff_file {
uintptr_t realptr; // at this point one could also just use void *.
};
extern int file_get_item(struct libpff_file x, int itmidx);
which is just a more fancy way of the first.
thx for the suggestions I'll take a closer look at these
The definition of
libpff_item_t
is compatible tolibpff_record_set_t
(and possibly others). This is very unfortunate, because it masks developer errors, for example when a logically different-typed thing is passed:Observed:
Expected to see: