-1
\$\begingroup\$

This question already has an answer here:

A few challenges that requires the program to output something at a specified length, and a bunch of answers well... uses built-in error messages that's generated by the interpreter rather than the program itself.

Say for example, this program outputs a total of 20 bytes (not counting trailing newline)

#!/bin/bash
@

with output

@: command not found

Of course this message will not appear in STDOUT, but STDERR instead (without redirection).

Should this count as a valid program that outputs something as long as 20 bytes?

\$\endgroup\$

marked as duplicate by Shaggy, Stephen, mbomb007, FryAmTheEggman, Mego Aug 16 '17 at 18:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ @Sanchises Go post an answer, please. \$\endgroup\$ – iBug Aug 15 '17 at 1:12
  • \$\begingroup\$ I do not believe this is a duplicate. Yes, STDERR is a default, but the OP has pointed out a situation in which it doesn't make a good deal of sense for it to be so. Rather than blindly follow the defaults maybe we should have a discussion about this particular case. \$\endgroup\$ – Wheat Wizard Aug 17 '17 at 18:15
5
\$\begingroup\$

Leave it to the writer of the challenge.

For some challenges, it may be acceptable, for some it may not be. We don't need an official meta consensus on this.

Note: this was first written as a comment, receiving 8 upvotes.

Edit: In general, you may also output to STDERR as a standard method of input/output, but keep in mind that writers of a challenge may want to deviate from the standards if they have good reason to do so. When in doubt, ask the OP.

\$\endgroup\$
  • \$\begingroup\$ We don't need an official meta consensus on this - thing is, we already do: codegolf.meta.stackexchange.com/a/2451/65836 \$\endgroup\$ – Stephen Aug 15 '17 at 15:38
  • \$\begingroup\$ @StepHen Good find (although it's just shy of a 2/3rd majority at this time, so it's hardly unanimous) \$\endgroup\$ – Sanchises Aug 15 '17 at 15:48
  • 1
    \$\begingroup\$ @StepHen The difference is that "output length" isn't a term we have defined. We've defined "output", but we haven't defined "output length". This may seem pedantic, but there are lots of forms of output we allow. Do we include STDERR or the exit code? If I return a function, how do we measure it's length? \$\endgroup\$ – Nathan Merrill Aug 15 '17 at 18:15
1
\$\begingroup\$

Yes

Outputting to STDERR is currently permitted under our standard I/O methods.

Note, though, that this may be overridden on a per-challenge basis by the challenge author.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .