Determine correct size of TICKER_CHARACTER_COUNT
Since tickerCharacters is a char pointer rather than a char array the result is: sizeof(8) / sizeof(1). However, desired result is: sizeof(5) / sizeof(1). See also following example: const char *tickerCharacters = "|/-\\"; const char _tickerCharacters[] = "|/-\\"; int main(void) { printf("%zu\n", (sizeof(tickerCharacters) / sizeof(char))); printf("%zu\n", (sizeof(_tickerCharacters) / sizeof(char))); return 0; } > gcc test.c -o test && ./test 8 5
This commit is contained in:
parent
fde6c680b3
commit
bcc8a05978
|
@ -104,7 +104,7 @@ typedef struct pageEntry_s {
|
|||
uint8_t flags;
|
||||
} pageEntry_t;
|
||||
|
||||
static const char* tickerCharacters = "|/-\\"; // use 2/4/8 characters so that the divide is optimal.
|
||||
static const char tickerCharacters[] = "|/-\\"; // use 2/4/8 characters so that the divide is optimal.
|
||||
#define TICKER_CHARACTER_COUNT (sizeof(tickerCharacters) / sizeof(char))
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in New Issue