# Should non-standard compiler flags be included in character counts? [duplicate]

In some languages using a compiler flag might significantly shorten the source file, by making the compilation command longer. Should we make inclusion of the character count of the flag in the total character count, mandatory?

EDIT: As mentioned by Chris Jester-Young the -D compiler flag for C/C++ could be game breaking if not included in the count. You could potentially define your whole program in the command line and have a source file that is only 1 character long.

• Can you provide example or link to it? – Nakilon Jan 27 '11 at 22:58
• What about interpreter arguments? perl/ruby -p for example. In Ruby's case you can also write it into the shebang and Ruby will gladly go ahead and parse that itself. – Joey Jan 29 '11 at 20:07

I think so. Otherwise, people can embed huge amounts of code in a C submission by using -D to define lots of macros "for free".

• I don't know if this justifies a general rule, but this particular case would count as cheating in my mind. – dmckee --- ex-moderator kitten Jan 27 '11 at 23:55
• @dmckee: Fair point. +1 – Chris Jester-Young Jan 27 '11 at 23:58

The big difficulty here follows from defining "non-standard". Presumably I am allowed gcc --std=c99 because that is standard, but what if I want -funsigned-char? The later tells gcc to use a valid (i.e. acceptable to the standard) interpretation of the source, just not the one gcc usually uses.

In or out?

And gcc has a lot of those kinds of options.

• If it feels like cheating and it looks like cheating and it smells like cheating and it tastes like cheating and it sounds like cheating... – gnibbler Apr 29 '11 at 5:27

Bottom line - I think we should disallow -D (or at least count its chars), and allow all the rest without counting.

-D can be used to write 1-byte programs, so it must be either disallowed or counted.
I prefer to disallow it, to discourage people from replacing #define with -D (we want short programs, not short programs + compilation lines).
-include should be treated the same (like -D, it replaces things which should have been in the source).

A simple case is -std=c99, -ansi etc. I think it's agreed that these don't need to be counted. You might as well count 3 chars for gcc (but I have c as an alias...)

Other flags, however, don't offer a clear way to save chars. They may end up useful in some circumstances, but they don't automatically shorten the program.
Finding flag that allows you to shorten your program is often quite creative. So I think it should be encouraged. If anyone finds a way to save a couple of chars using -fallow-parameterless-variadic-functions, I'm in favor. Adding 40 bytes makes it useless.

Some cases I actually saw on this site:

1. Using -O2 to optimize tail recursion:
I think it should be allowed for no charge. Also note that in most cases, the program could work without it, given a deep enough stack.

2. -msse3 -O3 -ffinite-math-only used in this answer:
The program works without the flags, just terribly slowly. I see no reason to charge for them.

3. -nostartfiles used in this answer:
The point here was not using the letter a in the program. But this letter does appear in the flag, so if counting the flags you should count the a.