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

swift - Button on Table View Cell connected to local function -

dns - Dokku server hosts two sites with TLD's, both domains are landing on only one app -

c# - ajax - How to receive data both html and json from server? -