api-sanity-checker icon indicating copy to clipboard operation
api-sanity-checker copied to clipboard

Why "unexpected output" warnings

Open cdeil opened this issue 13 years ago • 2 comments

I have a C++ library where a class method invocation prints something to std::cout. This is reported as an "unexpected output" warning by the api-sanity-checker.

Why does this trigger a warnings? Aren't libraries allowed to write something to the console?

I didn't find any explanation for "unexpected output" in the documentation, maybe you can add a bit?

Thanks!

cdeil avatar Nov 02 '12 16:11 cdeil

The unexpected output warning means, that function has printed something to stdout, but the name of this function doesn't contain any of these words: print, debug, warn, message, error, fatal. This warning is needed to catch forgotten debug printing in the code of the function if it is not designed to print anything. Also in some cases printing to stdout means that something is going wrong with the function.

What is the name of your function?

Could you please give me a source code of your library (if it's open), so I can adapt the tool to generate more meaningful test cases?

aponomarenko avatar Nov 02 '12 19:11 aponomarenko

Thanks for the info, this is pretty useful! Can you add the unexpected output warning description to the documentation?

The library I tried the api-sanity-checker on is here: http://gammalib.sourceforge.net

cdeil avatar Nov 05 '12 16:11 cdeil