|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug579.cpp
Our programmer is printing a message using a function with a variable argument list but something is going awry. Can you spot the problem? bug579.cpp lint Output
--- Module: bug579.cpp
_
void print_out( char n, ... )
bug579.cpp(3) : Warning 579: parameter preceding ellipsis has invalid type
_
printf( "%d", *(int *)(&n + 1) );
bug579.cpp(6) : Info 826: Suspicious pointer-to-pointer conversion (area too small)
_
printf( "%s", *(char **)(&n + 1) );
bug579.cpp(8) : Info 826: Suspicious pointer-to-pointer conversion (area too small)
Reference Manual Explanation
579 parameter preceding ellipsis has invalid type -- When an ellipsis is used, the type
preceding the ellipsis should not be a type that would undergo a default promotion such
as char, short or float. The reason is that many compilers' variable argument schemes
(using stdarg.h) will break down.
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #802 - May 2004