STMicroelectronics / STM32CubeF2

STM32Cube MCU Full Package for the STM32F2 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
43 stars 25 forks source link

typedef struct __* #15

Closed RetoFx closed 1 month ago

RetoFx commented 1 month ago

You add more and more names for your struct like

if USE_HAL_CAN_REGISTER_CALLBACKS == 1

typedef struct __CAN_HandleTypeDef

else

typedef struct

endif / USE_HAL_CAN_REGISTER_CALLBACKS /

in stm32f2xx_hal_can.h

I prefer that you always add a name to any struct. This reduced the #if #else #endif and simplified the source. Some other tools like pclint can reference to this name in the output.

Please don't use any symbols starting with an underscore. They are reserved for the compiler and should not be used for libraries or application code.

You can use for example

typedef struct CAN_HandleStruct { } CAN_HandleTypeDef;

ALABSTM commented 1 month ago

Hi @RetoFx,

Thank you for this other suggestion. Both points you raised are legitimate. However, such naming is currently deployed on almost all HAL drivers and we cannot afford any refactoring action.

I will forward your request to our development teams so it is considered for future development. Please allow me to close this issue. Thank you for your comprehension.

With regards,

RetoFx commented 1 month ago

But please add a struct name to any struct in any build variant. struct names are requierd to match forward declaration of a struct in C.