Skip to main content
Stecklo
Senior
Dec 27, 2019 10:38 AM UTC
Solved

non-const pointers as ACI commands' arguments

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);
 <...>
}

This topic has been closed for replies.
Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
Jan 7, 2020 8:43 AM UTC

​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.

3 replies

RMcCa
Senior II
Dec 27, 2019 11:19 AM UTC

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.​

Stecklo
SteckloAuthor
Senior
Dec 27, 2019 11:24 AM UTC

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)

Remi QUINTIN
Remi QUINTINBest answer
ST Technical Moderator
Jan 7, 2020 8:43 AM UTC

​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.