(clang) array initialisation test, -Wno-maybe-uninitialized!
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ C_FLAGS := $(C_DEF) \
|
||||
-Wcast-align=strict \
|
||||
-Wfloat-equal \
|
||||
-Wlogical-op \
|
||||
-Wno-unused-command-line-argument \
|
||||
-Wno-maybe-uninitialized \
|
||||
-Werror
|
||||
|
||||
BINARY := $(BIN_DIR)/$(NAME)
|
||||
|
||||
+4
-13
@@ -3,24 +3,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define STRING_LEN ((size_t) 16)
|
||||
#define ARRAY_SIZE ( ( int ) 16 )
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char string[STRING_LEN] = {'\0'};
|
||||
int array[ARRAY_SIZE] = { 0 };
|
||||
int n;
|
||||
|
||||
for (n = 0; n < (int)STRING_LEN; n++)
|
||||
for ( n = 0; n < ARRAY_SIZE; n++ )
|
||||
{
|
||||
printf("%2d: [0x%02X]\n", n, string[n]);
|
||||
}
|
||||
|
||||
(void) strcpy(&string[0], "hello there");
|
||||
|
||||
printf("\n");
|
||||
|
||||
for (n = 0; n < (int)STRING_LEN; n++)
|
||||
{
|
||||
printf("%02d: [0x%02X]\n", n, string[n]);
|
||||
printf( "array[%d] = %d;\n", n, array[n] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user