Strange gcc warning.

Roberto Bagnara bagnara at cs.unipr.it
Tue Apr 29 09:14:50 CEST 2008


ezzetabi wrote:
> 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
> 
> I see, then I need to use explicitly the type hidden by mpz_t?

I think all you need in this case is a cast: just write the
function call as

     f((const mpz_t*) e);

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it


More information about the gmp-discuss mailing list