#include <stdio.h>
#include <stdint.h>
#include <assert.h>
static_assert(sizeof(void *) == 8);
struct array32{
char unsafe[32];
char& operator [](uint64_t index)
{
assert(index < 32);
return unsafe[index];
}
};
static
array32 array32_set_safe(char *a)
{
array32 result;
int stringLength = snprintf(result.unsafe, 32, "%s", a);
assert(stringLength >= 0 && stringLength < 32);
return result;
}
int main(void) {
array32 eple = array32_set_safe("123456789012345678901234567890a");
printf("%s, %li\n", eple.unsafe, sizeof(array32));
return 0;
}