NanoLine's blog

By NanoLine, history, 23 months ago, In English

I challenge you to find a shorter code that the condition above is met.

#define min main(){}
min
  • Vote: I like it
  • +15
  • Vote: I do not like it

| Write comment?
»
23 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Just blank file

»
23 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

cool challenge

»
23 months ago, hide # |
Rev. 3  
Vote: I like it +1 Vote: I do not like it

this is the shortest i know for C++: main(){}

»
23 months ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

This one is 2 bytes shorter:

#define id main(){}
id
  • »
    »
    18 months ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    No 1-letter function exists in Python 3.12 so I'm pretty sure this is the shortest.

    • »
      »
      »
      18 months ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

      Thanks for replying; you brought my attention back to this problem, which caused me to think more about it. Turns out, there is a shorter solution. It uses an entirely different idea. Here it is:

      int
      exit();
      main()
      {}
      

      This compiles with g++ and runs with Python 3.11 (probably works with 3.12 too). It is 1 byte shorter than my previous solution.

      An even shorter solution can be compiled with gcc as C source code, but doesn't compile with g++ as C++ source code:

      exit();
      main()
      {}
      
»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

That looks cool I guess!

»
17 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it
#define id main(){}
id

it`s so fun!