For example, in a c++ submission, this is valid if you use g++
#include <iostream>
main()
{
std::cout << "Hello world!";
}
but in any other compiler, this would not compile because of the missing "int" keyword.
For example, in a c++ submission, this is valid if you use g++
#include <iostream>
main()
{
std::cout << "Hello world!";
}
but in any other compiler, this would not compile because of the missing "int" keyword.
In case your program is not portable you should specify the interpreter or compiler.
$
(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\$
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
g++ -O0
hackery, n bytesif 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.
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.