Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Dave Hanson
Thu, 22 Sep 1988 11:44
Re: Incorrect warning about incompatible arguments
Author: Dave Hanson
Date: Thu, 22 Sep 1988 11:44
Date: Thu, 22 Sep 1988 11:44
23 lines
1361 bytes
1361 bytes
In article <8809220411.AA01379@check.sm.unisys.com> pmontgom@SM.UNISYS.COM (Peter Montgomery) writes:
/*
On a SUN 3 at OS 4.0, GCC 1.28 warns "argument passing between
incompatible pointer types" for the call to mat_print. The warning does
not appear if "const" is omitted from the declaration of mat_print. GCC
1.26 did not give this warning. The object code is correct, with or
without optimization.
*/
void mat_print(const int mat[2][2]) {
printf("Matrix elements are %d %d %d %d\n", mat[0][0], mat[0][1],
mat[1][0], mat[1][1]);
}
main()
{
int a[2][2] = {10, 20, 30, 40};
mat_print(a);
}
i think this is correct. the type of the argument to mat_print
is `pointer to array of const int'. in main(), the type of a
is `pointer to array of int'. those two types are not
assignment compatible.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads