For example, I would like to do something like this:
#include <gmp.h>
typedef mpz_t Integer;
Integer F(Integer a,Integer b,Integer c,Integer d) {
Integer ret = times(plus(a,b),plus(c,d));
}
But, GMP does not allow me to do this, obviously mpz_t is an array, so I get the error:
error: ‘F’ declared as function returning an array
So instead, I would have to do something like this:
void F(Integer ret,Integer a,Integer b,Integer c,Integer d) {
Integer tmp1,tmp2;
plus(tmp1,a,b);
plus(tmp2,c,d);
times(ret,tmp1,tmp2);
}
This is unnatural and does not follow the logical way of adding C (or even mathematical) expressions. In fact, you cannot compose anything mathematically, because, apparently, you cannot return GMP numbers! If I wanted to write - for example, a simple yacc / bison parser that converted simple syntax with +, -, /, *, etc. In C code that implements these expressions using GMP, it seems to be a lot more complicated, since I will need to keep track of all the intermediate values.
, GMP ? "" mpz_t *, mpz_t? , , , ? - , ?