Should a warning go to stdout or stderr? -


should warning message go stdout or stderr?

is somewhere defined (e.g. in posix)?

this question doesn't related specific programming language or machine architecture.

it depends. example, suppose you're implementing sort program. program reads input stdin , writes stdout. suppose add option "numeric" sort instead of lexicographic sort (the details aren't important). suppose want write warning message if there aren't numbers found in input. sort still work, might not user intended. in case, want write warning message stderr, because stdout reserved actual sorted data.

on other hand, if you're writing program contact web service api, read json, extract info, , write info database, perhaps writing warning message stdout acceptable.

so, depends on application , how uses stdout. there no "standard".


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -