2017-09-14 02:08 AM
The title says it all (I hope I don't need to explain why). I'm using: STM32Cube_FW_F3_V1.9.0 And while someone is at it: The other transmit functions need to be fixed, too.
#bug2017-09-14 06:24 AM
Hello
moritz.struebe
,this is technically not a bug until function doesn't modify input content.
I agree, it would make sense to replace to const parameter.
Best regards,
Tilen
2017-09-14 08:47 AM
Posted on September 14, 2017 at 15:47
The function does and should not modify the content. Also
HAL_UART_Transmit(&huart2,"Hello", 5, 0xFFF);
Will cause a compile error.
2018-07-29 08:22 AM
I just ran into the same problem with
HAL_StatusTypeDef HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size);
pData should be "const uint8_t *". This causes me to write way too many const_cast<> in otherwise proper C++ code -- and then pray that the HAL designers are not doing anything funny with my buffer. "const" is a contract that the API makes with its users. Likewise, lack of "const" indicates that one MUST use double buffering if the original must not be modified by the called function, or they must be willing to break important code correctness rules.
ST, please fix this.
2018-07-29 10:12 AM
I'd kind of hope the compiler would also complain about strings with single-quotes too
2018-08-20 06:08 AM
@Community member Yes, yes. You're right. My bad. One should c&p working code and not make it up on the fly