[bug report] SDK v12 C++ issue in peer_manager_types declaration

Patrice gravatar image

asked 2016-09-08 17:08:50 +0100

updated 2016-09-08 17:09:16 +0100


I'm currently porting all my C++ code from SD130 SDK10 to SD132 SDK12 and I also upgrading from device_manger to peer_manager.

I've noticed that in peer_manager_types.h file there is a declaration with an empty array:

/**@brief Data on a local GATT database.
typedef struct
    uint32_t flags;       /**< @brief Flags that describe the database attributes. */
    uint16_t len;         /**< @brief Size of the attribute array. */
    uint8_t  data[];      /**< @brief Array to hold the database attributes. */
} pm_peer_data_local_gatt_db_t;

.. and this won't compile even if the #ifdef __cplusplus precompiler instruction is set. To fix that I've just sized the array data[1] with one element.

Kind Regards Patrice

edit retag flag offensive close delete report spam


It may be my poor understanding of C but wasn't it meant for data to be an array pointer so it should corrected to uint8_t* data?

Keton ( 2016-09-08 21:00:38 +0100 )editconvert to answer

Yes of course @keton, we can set it as a pointer... I've fixed this problem with an array of 1 element just to respect you way it's done in all other header's files, like ble_gattc.h.

Patrice Rudaz ( 2016-09-09 08:00:18 +0100 )editconvert to answer

It seems like this is C99 feature only. Some compilers might optionally add this feature but it seems not so common. Peer manager header files did not add support for CPP by adding#ifdef __cplusplus`, so they are not compiled and tested with any CPP compilers.

Aryan ( 2016-09-12 09:01:37 +0100 )editconvert to answer

Thanks Aryan for your comment... By the way, you Nordic guys have changed this in the header files of the SoftDevice API (ble_gattc.h, ble_gatts.h & ble_l2cap.h) from SDK10 to SDK11 in the same way I did here for the peer_manager module. That's why I thought it was an oversight...

Patrice Rudaz ( 2016-09-13 09:16:37 +0100 )editconvert to answer

1 answer

Sort by ยป oldest newest most voted
Aryan gravatar image

answered 2016-09-13 09:20:55 +0100

updated 2016-09-16 10:44:01 +0100

hi Patrice, this could be an oversight, i will inform the designer to change it but i cannot create any ticket on it. I hope this is ok.


just talked to the developer and he will change this member to data[1];

edit flag offensive delete publish link more



Technically this is not a bug, as SDK only supports C99 compilers officially for now. But we cannot ignore other compiler users, so I updated list in SDK11 and SDK12 known issues with this thread

Aryan ( 2016-09-16 10:47:33 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

Question Tools



Asked: 2016-09-08 17:08:50 +0100

Seen: 244 times

Last updated: sep. 08 '16