|
![]() Click on image to see enlargment |
|
PC-lint/FlexeLint Output | Reference Manual Explanation | Home bug427.cpp
The programmer expected his program to produce an error message if no command line arguments were supplied. Instead he received no output. How come? (thanks to Martyn Honeyford of IBM UK Labs). bug427.cpp lint Output
-- Module: bug427.cpp
_
// show line number first \
bug427.cpp(5) : Warning 427: // comment terminates in \
_
fprintf( stderr, "Error(%d):", __LINE__ ),\
bug427.cpp(6) : Warning 427: // comment terminates in \
Reference Manual Explanation
427 // comment terminates in \ -- A one-line comment terminates in the back-slash
escape sequence. This means that the next line will be absorbed in the comment (by
a standards-conforming compiler -- not all compilers do the absorption, so beware).
It is much safer to end the line with something other than a back-slash. Simply
tacking on a period will do. If you really intend the next line to be a comment,
the line should be started with its own double slash (//).
If you have comments or questions about this bug, please post them to our Discussion Forum |
Previous Bug - Bug #524 - January 2004