Hi everyone, I have some problem with SDK 17, when I try compile it by C++ compiler. Compiler detected many errors, for example:
- nrf_fprintf,c problem with va_lista
va_list should never be initialized. It's standard in C and C++ that it is just left uninitialized until va_start() is called
- ble_lbs.c (and many services example)
Problem wit missing assignament to variable VERIFY_SUCCESS(error_code);
- nrf_atflags.h
Missing on top
#ifdef __cplusplus
extern "C" {
#endif
- nrf_sdh.h, nrf_sdh_soc.h, nrf_sdh_ble.h
Problem with construction for example:
typedef struct
{
…….
} const nrf_sdh_req_observer_t
I m not sure that construction with const is acceptable, please give me reason for using such a structure.
According to: https://en.cppreference.com/w/cpp/language/typedef
“The typedef specifier cannot be combined with any other specifier except for type-specifiers.”
- Many files for example gatt_cache_manager.c
Problem with order inicjalization.
pm_evt_t event =
{
.evt_id = PM_EVT_SERVICE_CHANGED_IND_CONFIRMED,
.peer_id = im_peer_id_get_by_conn_handle(conn_handle),
.conn_handle = conn_handle,
};
error: designator order for field ‘pm_evt_t::conn_handle’ does not match declaration order in ‘pm_evt_t’
According to: https://en.cppreference.com/w/cpp/language/aggregate_initialization
“The syntax forms (3,4) are known as designated initializers: each designator must name a direct non-static data member of T, and all designators used in the expression must appear in the same order as the data members of T.”