Skip to main content
added 714 characters in body
Source Link
ecatmur
  • 1.7k
  • 10
  • 15

C

No string literals or comments:

Better(to,re);main(silent){and();}be(thought,a,fool){}
than(to,open,your,mouth);and(){}remove(all,doubt);

Split over two lines, but one would work fine as well.

When compiled using gcc on Linux (x86-64), this produces an executable which exits with success (exit code 0), the same as the true Unix utility; this being how I choose to interpret the requirement of returning boolean true in a non-scripting language.

Note: notwithstanding the abuse of the "implicit int" rule, the principal trick behind this program is that while a C program that falls off the end of main without a return statement will usually result in a non zero exit code, by calling another function we can set the EAX register which is then used as the exit code of the program. This is of course totally undefined behaviour and utterly non portable.

C

Better(to,re);main(silent){and();}be(thought,a,fool){}
than(to,open,your,mouth);and(){}remove(all,doubt);

Split over two lines, but one would work fine as well.

C

No string literals or comments:

Better(to,re);main(silent){and();}be(thought,a,fool){}
than(to,open,your,mouth);and(){}remove(all,doubt);

Split over two lines, but one would work fine as well.

When compiled using gcc on Linux (x86-64), this produces an executable which exits with success (exit code 0), the same as the true Unix utility; this being how I choose to interpret the requirement of returning boolean true in a non-scripting language.

Note: notwithstanding the abuse of the "implicit int" rule, the principal trick behind this program is that while a C program that falls off the end of main without a return statement will usually result in a non zero exit code, by calling another function we can set the EAX register which is then used as the exit code of the program. This is of course totally undefined behaviour and utterly non portable.

Source Link
ecatmur
  • 1.7k
  • 10
  • 15

C

Better(to,re);main(silent){and();}be(thought,a,fool){}
than(to,open,your,mouth);and(){}remove(all,doubt);

Split over two lines, but one would work fine as well.