请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
工具/软件:TI C/C++编译器
我发现TI的armcl编译器有一些奇怪之处,当变量通过const_cast被转换为typedef时,它报告错误“a const_cast only adjust type qualifiers;it cannot change the underlying type”。 可使用以下示例复制该文档:
extern "C" void (*const interruptvectors[])(); typedef void (*ISR_t)(void); static ISR_t* source_vector_table = const_cast<ISR_t*>(interruptvectors);
armcl不编译这个,尽管我认为没有错误,因为interruptVector的类型是const ISR_t*。gcc和clang都使用-Wall -WExtra -Wpedantic编译代码片段,并且只报告未使用的变量SOURIC_VICER_TABLE。