Empty program: Difference between revisions
→[[C plus plus|C++]]: return statement for main is optional in c++ |
→[[C plus plus|C++]]: parameters to main in c++ are optional |
||
Line 25:
Compiler: [[GCC]] 4.0.3
int main (
{
|
Revision as of 13:40, 23 January 2007
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
In this task, the goal is to create the simplest possible program that is still considered "correct."
Ada
Compiler: GCC 4.1.2
procedure Empty is begin null; end;
BASIC
Compiler: QBASIC
END
C
Compiler: GCC 4.0.3
int main (int argc, char *argv[]) { return 0; }
C++
Compiler: GCC 4.0.3
int main () { }
C#
Compiler: Microsoft (R) Visual C# 2005 Compiler version 8.00
static class Program { static void Main(string[] args) { } }
Haskell
Compiler: any Haskell98 compiler
module Main where
main :: IO () main = return ()
Java
Compiler: Sun javac, JDK 1.5.0 and up
public class EmptyMainClass { public static void main(String[] args) { } }
public class EmptyApplet extends java.applet.Applet { @Override public void init() { } }
Compiler: Sun javac, JDK 1.0 and Up
public class EmptyMainClass { public static void main(String[] args) { } }
public class EmptyApplet extends java.applet.Applet { public void init() { } }
@Override will be telling the compiler need to override this function. It's presents from JDK 5.0 (1.5.0) and up
Actually this is not strictly correct. The smallest possible correct program in Java is an empty source file.
LaTeX
Compiler: pdfeTeXk, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5), LaTeX2e <2003/12/01>
\documentclass{article} \begin{document} \end{document}
Pascal
Compiler: Borland Pascal
program ProgramName; begin end.
Perl
Interpreter: Perl 5.8.8
#!/usr/bin/perl
PHP
<?php ?>
Python
Interpreter: Python 2.4.3
#!/usr/bin/env python
Ruby
Interpreter: Ruby 1.8.5
#!/usr/bin/env ruby
Starting an Interactive RuBy shell
irb
UNIX Shell
Interpreter: Debian Almquist SHell
#!/bin/sh
Interpreter: Bourne Again SHell
#!/bin/bash
VB.NET
Compiler: Microsoft (R) Visual Basic Compiler version 8.0
Module General Sub Main() End Sub End Module
xTalk
Interpreter: HyperCard
on startup end startup