non-const pointers as ACI commands' arguments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-27 2:38 AM
I wonder why are all ACI commands, that imply using pointer-to-const parameters actually use non-const ones? Is there any reason? Will it ever be fixed?
For example:
tBleStatus aci_gatt_add_service(uint8_t Service_UUID_Type,
Service_UUID_t *Service_UUID,
uint8_t Service_Type,
uint8_t Max_Attribute_Records,
uint16_t *Service_Handle)
{
<...>
Osal_MemCpy((void *) &cp0->Service_UUID, (const void *) Service_UUID, size);
<...>
}
Solved! Go to Solution.
- Labels:
-
STM32WB series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-07 12:43 AM
​A request has been done to improve the type of those pointers to const values.
No date when it will be done and released.
Meanwhile you can do the cast for your development.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-27 3:19 AM
I believe that using const in the parameters of a function call merely indicates that it is not altered by the function, i.e. a constant.​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-12-27 3:24 AM
Surely it does.
But if there is no const qualifier I cannot pass const Service_UUID_t parameter. I need to either make parameter non-const at the declaration (which is bad), or use const_cast (which is even worse)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-07 12:43 AM
​A request has been done to improve the type of those pointers to const values.
No date when it will be done and released.
Meanwhile you can do the cast for your development.
