我有这段代码:
FLAC__StreamDecoderWriteStatus writeCallback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) {
//impl....
}
然后我有这个声明:
{
/// stuff
FLAC__StreamDecoderWriteStatus (*writeCallbackPtr) (const FLAC__StreamEncoder *, const FLAC__byte , size_t , unsigned , unsigned , void *) = writeCallback;
// more stuff
}
我对错误的理解是两者的类型不同,但我不明白在这种情况下我做错了什么。
答案 0 :(得分:1)
您的声明有误,应该是
FLAC__StreamDecoderWriteStatus (*writeCallbackPtr) (
const FLAC__StreamEncoder *,
const FLAC__byte[],
/* here ^ you missed the [] */
size_t ,
unsigned ,
unsigned ,
void *) = writeCallback;