【发布时间】:2009-09-24 18:39:59
【问题描述】:
我目前有这个代码:
static void func( uint8_t var );
static volatile uint8_t foo;
int main() {
/* Here we have to cast to uint8_t */
func( (uint8_t) foo );
/* This will not compile */
func( foo );
}
有没有办法避免函数调用中的强制转换?
【问题讨论】:
-
哪个编译器会为此给出错误? VS2005 和我过时的 cygwin gcc 编译这个没有问题。
-
请注意:uint8_t 不需要存在于所有 C99 实现中,即使在 #includ'ing
之后也是如此