I see two parts to your question. The first part, how the typedef works for passing arguments to functions, would better be illustrated with an example. Without it, I'll have to guess a bit.
In C function declarations, an array parameter is equivalent to a pointer. That's why you see (for example) equivalently for the main function,
int main(int argc, char **argv)
and
int main(int argc, char *argv[])
Similarly, if a function in your program would be declared
int func(__mpz_struct *arg)
it would be equivalent to
int func(__mpz_struct arg[])
and hence to
int func(mpz_t arg)
Also, on the calling side, if you have a variable of type mpz_t, hence the array, and you pass it to a function, the "pointer decay" takes effect: in an expression, if you use (the name of) an array it "decays" into a pointer to its first element.
This way you can call the function:
mpz_t value;
func(value);
Of course, to modify these mpz_t objects outside of the API functions, you still have to be aware of their true nature.
The side effects that you mention, I would also have to guess about them. Possibly it is meant that you have to be aware you're working with pointers inside the functions. It might be considered better to make that explicit by using the pointer syntax.
struct
var using the&
-operator? – Rabermpz_t m; __mpz_struct * p = &(m[0]) + 1;
would be valid, whereas__mpz_struct MP_INT; __mpz_struct * p = (&MP_INT) + 1;
wouldn't. – RaberMP_INT some_variable; __mpz_struct * p = (&some_variable) + 1;
because this would work. – DekaliterMPINT some_variable;
. ThisMP_INT * p = (&some_variable) + 1;
however will invoke undefined bahaviour. @AbinashMeher – Raber