I have the following code in spbox.c:
#include <stdbool.h>
#include <stdint.h>
typedef struct {
bool initialized;
uint32_t Spbox[8][64]; // Combined S and P boxes
} spboxState;
static spboxState stateInstance;
uint32_t ** desGetSpbox(void) {
if (!(stateInstance.initialized)) {
// TODO: Compute data to populate Spbox array
stateInstance.initialized = true;
}
return stateInstance.Spbox;
}
I compile it:
clang -c spbox.c
I get a warning about incompatible pointer return types:
spbox.c:16:9: warning: incompatible pointer types returning 'uint32_t [8][64]' from a function with result type 'uint32_t **' (aka 'unsigned int **') [-Wincompatible-pointer-types]
return stateInstance.Spbox;
^~~~~~~~~~~~~~~~~~~
1 warning generated.
How do I change my code to make the warning go away? It is saying that uint32_t ** isn't compatible with uint32_t [8][64]. But if I try to make the later the return type, I get a syntax error.