0

在处理我的同步元组时,我以前有以下代码:

static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
  persist_write_bool(key,new_tuple->value->bool);
}

但是,我只是尝试构建它(在 Cloud Pebble 中),并得到了错误:

../src/main.c: In function 'sync_tuple_changed_callback':
../src/main.c:25:44: error: expected identifier before '_Bool'

这是怎么回事?

4

1 回答 1

1

没有工会bool成员value——最好的办法是使用该uint8成员,将 1 表示为真,将 0 表示为假:

static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) {
  persist_write_bool(key,new_tuple->value->uint8 != 0);
}
于 2015-10-28T07:16:37.843 回答