# Command-line flags in quines

For languages that use command-line flags to modify their behavior, these flags are generally added to the byte count. But I don't see a ruling on what to do with command-line flags in challenges. I.e. suppose this was a quine: perl -ne 'quine_program'. I see a few options:

• Output the flags. They are part of the source code: their bytes are counted as such, and the program wouldn't work without them. Con: how to format them? Outputting nquine_program would indicate that the code was nquine_program, not quine_program with the n flag. Maybe a newline in between?
• Don't output the flags. They are not really part of the source code, as the objection to the above point shows. Con: this opens all the same loopholes that not counting flags in the byte count opens.
• Flags are banned in quine challenges. They're too much of a corner case. Do what you need to do in the code itself. Con: flags are really useful and idiomatic (maybe even necessary) for some languages.

What say ye?

• I think saying flags are "useful and idiomatic" is an understatement some languages cannot print a Quine without some command line flag. – Wheat Wizard Jan 16 '17 at 19:00

# A quine outputs its source code verbatim

That sounds like stating the obvious, but the answer is right there - nowhere in the definition of a quine is there any reference to command-line arguments. For the purposes of quining, the only output should be the source code. Any non-standard command-line arguments don't matter except for the byte penalty.

So, to use your example, the program quine_program, run with perl -ne 'quine_program', should output quine_program, and would have a score of 14 bytes (13 for the source code plus 1 for the non-standard command-line flag).

• I like this answer, but how does it apply to the -D flag in C? If we allow -D under these rules, then I can write a C quine in 28 bytes: code is A, compilation option -D'A=main(){printf("A");}' Seems like cheating. Do we want to make an exception for -D, as the answers here suggest? – DLosc Jan 16 '17 at 21:10
• @DLosc That should be added as a standard loophole, if it's not already covered by one already. – Mego Jan 16 '17 at 21:11
• Hm. It might fall under Outsourcing the real answer; somewhat related to Using the program name to store data; but no, I don't think it's really covered by the current loopholes, possibly because we already found a way to make the bytes count (well, most of them). I don't have time to type up a loophole answer right now, but if you do I'll upvote it. – DLosc Jan 16 '17 at 21:27
• @DLosc Unfortunately, I don't have time right now, either. If nobody's done it by this evening (my time), I'll write one up. – Mego Jan 16 '17 at 21:29
• I'm not sure if a loophole is necessary, as a quine that uses -D doesn't work under our current definition of a quine: "It must be possible to identify a section of the program which encodes a different part of the program. ("Different" meaning that the two parts appear in different positions.)" – Nathan Merrill Jan 26 '17 at 4:52
• @NathanMerrill Good point. What about code AB, flags -D'A=main(){' -D'B=printf("AB");}'? The B in the code encodes both the A and the B; the A is just needed to make the B part run. – DLosc Jan 26 '17 at 20:31
• I'd still argue at that point that the -D option is doing the encoding, not the "B" – Nathan Merrill Jan 26 '17 at 20:35
• I would say that command line flags are allowed as long as they don't include logic - for example, a flag to print the last evaluated expression is ok, a flag that encodes the program is not allowed. However, it's hard to draw the line. – FlipTack Jan 28 '17 at 20:51