mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 04:15:44 +03:00
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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue