[Bug c/33076] Warning when passing a pointer to a const array to a function that expects a pointer to a non-cast one
m-matti-a dot lehtonen at iki dot fi
gcc-bugzilla@gcc.gnu.org
Tue Nov 20 21:53:00 GMT 2007
------- Comment #10 from m-matti-a dot lehtonen at iki dot fi 2007-11-20 21:53 -------
This code piece cannot compiled without warnings or errors.
/*! Presentation of transformation matrix */
typedef coordinate_t transform_matrix_t[ 4 ][ 4 ];
...
void
transform_concat
(
transform_matrix_t transform,
transform_matrix_t const transform1,
transform_matrix_t const transform2
);
...
void
transform_rotate
(
transform_matrix_t transform,
real_t const angles[ 3 ]
)
{
transform_matrix_t
temp;
...
transform_concat( transform, transform, temp );
...
}
Without casts I got two warnings:
warning: passing argument 2 of ‘transform_concat’ from incompatible
pointer type
warning: passing argument 3 of ‘transform_concat’ from incompatible
pointer type
And if arument 2 and 3 are casted as
transform_concat( transform, (const transform_matrix_t) transform, (const
transform_matrix_t) temp );
Then I got two errors:
error: cast specifies array type
error: cast specifies array type
--
m-matti-a dot lehtonen at iki dot fi changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |m-matti-a dot lehtonen at
| |iki dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33076
More information about the Gcc-bugs
mailing list