Possible Duplicate:
casting unused return values to void
Need for prefixing a function with (void)
Casting function returns to void可能重复:将未使用的返回值转换为void需要为函数添加前缀(void)Casting函数返回void
Have seen in quite few places that while invoking the function why do we explicitly the return type of the function ? ex:
已经在很少的地方看到,在调用函数时为什么我们明确地返回函数的类型?例如:
(void) myhostnames ( char * something);
What is use of this (void), and how it differs from not using the same ? Kindly clarify.
这是什么(无效),它与不使用它有什么不同?请澄清一下。
1 个解决方案
#1
4
Perhaps the function returns something and to prevent warnings from the compiler / errors from lint, the caller explicitly "throws" away the return.
也许该函数返回一些内容并防止来自编译器的警告/来自lint的错误,调用者明确地“抛出”返回。
#1
4
Perhaps the function returns something and to prevent warnings from the compiler / errors from lint, the caller explicitly "throws" away the return.
也许该函数返回一些内容并防止来自编译器的警告/来自lint的错误,调用者明确地“抛出”返回。