O
Old Wolf
I have a function that always takes 16 bytes of data and doesn't modify
it:
void func( byte const (*data)[16] );
However, if I try to call it with non-const data, the compiler is
unable to perform the conversion:
static const byte bar1[16] = { 0 };
int foo()
{
byte bar2[16] = { 0 };
func( &bar1 ); /* OK */
func( &bar2 ); /* Error */
}
Is there any work-around to this, other than defining a const and a
nonconst version of func, or passing a pointer to the first element
of data and thereby losing the compile-time length check?
it:
void func( byte const (*data)[16] );
However, if I try to call it with non-const data, the compiler is
unable to perform the conversion:
static const byte bar1[16] = { 0 };
int foo()
{
byte bar2[16] = { 0 };
func( &bar1 ); /* OK */
func( &bar2 ); /* Error */
}
Is there any work-around to this, other than defining a const and a
nonconst version of func, or passing a pointer to the first element
of data and thereby losing the compile-time length check?