Skip to main content
Stecklo
Senior
December 27, 2019
Solved

non-const pointers as ACI commands' arguments

  • December 27, 2019
  • 3 replies
  • 936 views

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.
Best answer by Remi QUINTIN

​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
December 27, 2019

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
December 27, 2019

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
Technical Moderator
January 7, 2020

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