cancel
Showing results for 
Search instead for 
Did you mean: 

non-const pointers as ACI commands' arguments

Stecklo
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

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

View solution in original post

3 REPLIES 3
RMcCa
Senior II

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
Senior

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
ST Employee

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