In MPFR the basic data types are defined as
typedef struct {
[...]
} __mpfr_struct;
typedef __mpfr_struct mpfr_t[1];
typedef __mpfr_struct *mpfr_ptr;
and functions in the header are using mpfr_ptr
, e.g.
void mpfr_init (mpfr_ptr)
but the docs are just using mpfr_t
instead
void mpfr_init (mpfr_t x) .
Honestly I think this is misleading, and I actually had some issues with shared_ptr
s which I couldn't resolve easily because of this.
My best guess is that MPFR did typedef __mpfr_struct mpfr_t[1]
so people can just "blindly" put it into the functions like the docs suggest?! Are there any other reasons not to do typedef __mpfr_struct mpfr_t
instead, change the docs to what's in the header and trust people are good enough with simple pointers or am I missing something?