meaning of code: (void)<variable>;

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

What does this line of code do? (void)<variable>;

Below is an example:

case CYBLE_EVT_GAP_AUTH_COMPLETE:            

            authInfo = (CYBLE_GAP_AUTH_INFO_T *)eventParam;

            (void)authInfo;

            DBG_PRINTF("AUTH_COMPLETE: security:%x, bonding:%x, ekeySize:%x, authErr %x \r\n",

                                    authInfo->security, authInfo->bonding, authInfo->ekeySize, authInfo->authErr);

            break;

0 Likes
2 Replies
Anonymous
Not applicable

Hello,

(void)authInfo; This is added to avoid any compiler warnings in case if the authInfo is unused in your code.

This not any specific requirement for the BLE design.

Thanks,

Ranjith

Anonymous
Not applicable

Thanks a lot, rjks​!

0 Likes