jfuu
October 25, 2024, 3:25pm
1
What’s the name prefix for array variables? It seems like there’s a mix of p (pointer) prefix and no pointer prefix.
I’d link to the sources but it seems like new users can’t post links, so here are some examples (commit hash 7215c89aa81501f60af8df68dfa99fc2c118a293):
tasks.c (p prefix)
377 #endif
378 char pcTaskName[ configMAX_TASK_NAME_LEN ];
379
tasks.c (no prefix)
3507 BaseType_t xCoreID;
3508 char cIdleName[ configMAX_TASK_NAME_LEN ];
3509 TaskFunction_t pxIdleTaskFunction = NULL;
htibosch
(Hein Tibosch)
October 25, 2024, 4:21pm
2
I think that char cIdleName[] should be written as a char pcIdleName[], because it is a point to a character array.
jfuu
October 25, 2024, 4:28pm
3
I guess that should apply to all arrays of any type? FreeRTOS-Plus-TCP seems to use a mix too:
FreeRTOS-Plus-TCP/source/include/FreeRTOS_IP.h (line 330-334)
BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ],
const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
FreeRTOS-Plus-TCP/source/include/FreeRTOS_DHCPv6.h (line 111)
uint8_t pucID[ DHCPv6_MAX_CLIENT_SERVER_ID_LENGTH ]; /**< Universally Unique IDentifier (UUID) format. */
I agree that the p makes more sense - it makes it apparent that it’s not just a single value.
archigup
(Archit Gupta)
October 25, 2024, 10:30pm
4
Hi, the style guide is here: Coding Standard, Testing and Style Guide - FreeRTOS™
It doesn’t mention arrays directly, but seems like it should be p. Unfortunately there are some inconsistencies, and some of the prefixes may be incorrect.