cancel
Showing results for 
Search instead for 
Did you mean: 

HAL functions using archaic terms - why?

onderdelen
Associate III

Hi,

 

I am compiling the STM32U0 HAL library and I get errors like this one:

/Users/kiwanda/techniek/swexternals/STM32/HAL/Libraries/STM32U0xx_HAL_Driver/Inc/stm32u0xx_ll_comp.h: In function 'uint32_t LL_COMP_GetCommonWindowMode(const COMP_Common_TypeDef*)':
/Users/kiwanda/techniek/swexternals/STM32/HAL/Libraries/STM32U0xx_HAL_Driver/Inc/stm32u0xx_ll_comp.h:391:27: error: ISO C++17 does not allow 'register' storage class specifier [-Werror=register]
  391 |   register const uint32_t window_mode_comp_odd = (uint32_t)READ_BIT(COMPxy_COMMON->CSR_ODD, COMP_CSR_WINMODE);

I am using a C++ compiler and since C++14 the keyword register has been declared obsolete and useless. I fully agree with this step, all the more since we are writing SW here on ARM Cortex:

When writing software for ARM Cortex, which is a Load/Store architecture RISC processor, EVERYTHING goes through a register. The register keyword is therefore completely meaningless, useless and superfluous in this context.

I would like to ask ST to write the HAL libraries in such a way that they can also be used in modern contexts like the one I prefer to use. Checking the library with a C++ compiler is very effective since it finds anomalies and errors that (lax) C compiler disregard.

with best regards,

Ewout Boks

Ewout Boks

 

2 REPLIES 2
TDK
Super User

Mistakes happen. Looks like the "register" keyword is used exactly twice in the entire HAL library, just where you show it. Hardly a systemic issue.

If you feel a post has answered your question, please click "Accept as Solution".
gbm
Principal

register is not "completely meaningless". It may be used to ensure that error is signaled if & (address of) operator is used.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice