Strange gcc warning.
ezzetabi
ezzetabi at hotmail.com
Thu Apr 24 11:43:38 CEST 2008
Roberto Bagnara <bagnara at cs.unipr.it> wrote:
> ezzetabi wrote:
> > Here a minimalistic example:
> > /* min.c */
> > #include <gmp.h>
> > void f(const mpz_t* t) {
> > t = t;
> > }
> > int main() {
> > mpz_t e[5];
> >
> > f(e);
> > return 0;
> > }
> See 6.7.3#8 of the C99 standard and
> http://c-faq.com/ansi/constmismatch.html
> All the best,
> Roberto
I see, then I need to use explicitly the type hidden by mpz_t?
Like this? (pretty bad because force the caller using a strange sintax)
#include <gmp.h>
void f(__mpz_struct const* t) {
t = t;
}
int main() {
mpz_t e[5];
f(&(e[0][0]));
return 0;
}
or this? (even worse since it forces the caller using an different type)
#include <gmp.h>
void f(__mpz_struct const* t) {
t = t;
}
int main() {
__mpz_struct e[5];
f(e);
return 0;
}
And there is there a way to avoid use the forbidden identifier __mpz_struct?
do exist a typedef for it that is not an array?
Or there is a different clean solution for using const arrays of mpz_t?
ezzetabi
More information about the gmp-discuss
mailing list