For example, in a c++ submission, this is valid if you use g++

#include <iostream>
    std::cout << "Hello world!";

but in any other compiler, this would not compile because of the missing "int" keyword.

  • \$\begingroup\$ If we're allowed to rely on undefined behavior, using a GNU dialect of C++ should be a problem. \$\endgroup\$
    – Dennis
    Commented Sep 1, 2015 at 4:23

2 Answers 2


Yes, on PPCG a language is defined by its implementation.

In case your program is not portable you should specify the interpreter or compiler.

  • 3
    \$\begingroup\$ I agree that compiler-specific submissions should be allowed and in such a situation the compiler in question should be specified, but I wouldn't go as far as saying that a language is defined by its implementation. That sounds like it could open up a loophole whereby solutions exploit obviously unintended bugs in a specific compiler (or is that okay too? I can't decide). \$\endgroup\$
    – Sp3000
    Commented Sep 1, 2015 at 4:44
  • 1
    \$\begingroup\$ @Sp3000 This is the flipside of the question "Is a submission that only works due a bugfix to a compiler which happened after the submission allowed?", which has generally been answered yes. \$\endgroup\$
    – isaacg
    Commented Sep 1, 2015 at 10:17
  • 1
    \$\begingroup\$ I'm conflicted. For example: If I were to implement a golf solution in my beloved language AutoIt, I could just use the old Beta, the only version where you can omit the variable marker $ (var instead of the usual $var). While this is technically the same language, I would consider this "cheating" and not allow it. This makes this question heavily opinion based ... \$\endgroup\$
    – user42643
    Commented Sep 14, 2015 at 7:17
  • 3
    \$\begingroup\$ @minxomat I do not consider that cheating. Using old versions of programming language implementations is allowed, look at Python2 being often used for example. \$\endgroup\$
    – orlp
    Commented Sep 14, 2015 at 7:35
  • \$\begingroup\$ @orlp What if that version of the compiler is not avail. from official sources? Python2, as far as I know, is still featured on the official website, while all the Au3 Betas <3.3.10.x are not. You can still download them elsewhere though. \$\endgroup\$
    – user42643
    Commented Sep 14, 2015 at 7:37
  • \$\begingroup\$ @minxomat Generally an interpreter needs to be freely available, or very mainstream (think MATLAB). \$\endgroup\$
    – orlp
    Commented Sep 14, 2015 at 7:49
  • \$\begingroup\$ @orlp I would add this as a general rule to challenges. "You can use any version of your language as long as that version freely available". Or something along those lines. \$\endgroup\$
    – user42643
    Commented Sep 14, 2015 at 7:52
  • \$\begingroup\$ I assume that because this statement is written in bold and large letters that it was decided on in an earlier meta thread. But I can't find the thread anywhere. Could someone point me to it please? \$\endgroup\$ Commented Oct 24, 2016 at 17:24

If your program isn't standard C++, then you shouldn't call it C++. The name of the language dialect you're using then involves the compiler, so you might need to say

x86-64 g++ -O0 hackery, n bytes

if you're doing something horrible like depending on g++'s current behaviour in un-optimized code of evaluating expressions in the return-value register, and depending on that to "return" a value without typing return. e.g. if your code only works in debug-mode, you need to say so.

It's expected that valid answers work for the "right" reason, and not just as a side effect of an implementation. And that they'll continue to work when compiled with different surrounding code, or different options. (IMO leaving out a return for answers like f(int n){++n;} is not an interesting source of byte savings. Don't worry so much about competing with other languages, just make it the best C++ program you can.)

For well-defined C++ dialects like GNU C++, use its name if you take advantage of GNU extensions that ISO C++ doesn't have, like C99-style variable-length arrays (int foo[n]) or whatever other feature that GNU C++ allows but ISO C++ doesn't.

GNU C++, n bytes

This is appropriate for stuff that GNU C++ documentation specifies will continue to work in future versions of g++, and isn't just a fluke. C-like features such as accepting a main with a default-int return type would fall in this category.


You must log in to answer this question.

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