Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Smallest "Hello World" Challenge

Name: Anonymous 2011-10-24 15:36

Program:
1.cannot: use assembler and non-portable OS APIs
2.outputs "Hello World" in visible form.
3.must be compiled into a single program unit which can be transferred between any two machines(with same OS) and run "Hello World".

Name: Anonymous 2011-10-24 15:40

same OS and same processor ? and what does non-portable mean ?

#!/bin/sh
echo "hello world"

Name: Anonymous 2011-10-24 15:41

cannot use assembler
must be compiled
mind=blown

Name: Anonymous 2011-10-24 15:45

hello world

howcoolami?timeforanotherline

Name: Anonymous 2011-10-24 15:50

Just statically link a C program or something.

Name: Anonymous 2011-10-24 16:04

FIOC
"Hello World"

Name: Anonymous 2011-10-24 16:19


public class HelloWorld
{
  public static void main(String[] args)
  {
    System.out.pritnf("Hello World%n");
  }
}

Name: Anonymous 2011-10-24 16:31

>>7
whats wrong with this assghole here?

Name: Anonymous 2011-10-24 16:36

print "Hello World"

just ship the .pyc file around.

Name: Anonymous 2011-10-24 16:41

>>7
fucking lol

Name: Anonymous 2011-10-24 17:00

Pascal: 31028 bytes main.exe
begin 
 Write ('Hello World'); 
end.

Name: Anonymous 2011-10-24 17:20

Deadfish~
w

Name: DCPagan 2011-10-24 17:24

echo 'Hello, World'

execute this shell script with any POSIX-compliant shell.

Name: Anonymous 2011-10-24 17:29

>>13
or even:
echo Hello World

3 characters shorter

Name: Anonymous 2011-10-24 17:29

>>7
pritnf
That was enterprise quality!

Name: Anonymous 2011-10-24 17:47

$ perl -e 'print "Hello World!\n";'
Hello World!

Works on any UNIX standard install of Perl.

Name: Anonymous 2011-10-24 18:01

alias echo to e

e hello world

Name: Anonymous 2011-10-24 18:07

Why the fuck are you retards even responding to this thread?

Name: Anonymous 2011-10-24 18:16

>>18
I guess they were trolled.

Name: Anonymous 2011-10-24 18:21

>>16
Modern Perl Edition
$ perl -E 'say "Hello, world!"'

Name: Anonymous 2011-10-24 18:28


10 PRINT "HELLO WORLD"


Every proper computer boots into a dialect of BASIC

Name: Anonymous 2011-10-24 18:36

Standard APL
'Hello World'

Name: Anonymous 2011-10-25 1:20

//+---------------------------------------------------------------------------
//
//  HELLO_WIN.C - Windows GUI 'Hello World!' Example
//
//+---------------------------------------------------------------------------

#include <windows.h>

#define APPNAME "HELLO_WIN"

char szAppName[] = APPNAME; // The name of this application
char szTitle[]   = APPNAME; // The title bar text
char *pWindowText;

HINSTANCE g_hInst;          // current instance

void CenterWindow(HWND hWnd);

//+---------------------------------------------------------------------------
//
//  Function:   WndProc
//
//  Synopsis:   very unusual type of function - gets called by system to
//              process windows messages.
//
//  Arguments:  same as always.
//----------------------------------------------------------------------------

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
        // ----------------------- first and last
        case WM_CREATE:
            CenterWindow(hwnd);
            break;

        case WM_DESTROY:
            PostQuitMessage(0);
            break;


        // ----------------------- get out of it...
        case WM_RBUTTONUP:
            DestroyWindow(hwnd);
            break;

        case WM_KEYDOWN:
            if (VK_ESCAPE == wParam)
                DestroyWindow(hwnd);
            break;


        // ----------------------- display our minimal info
        case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC         hdc;
            RECT        rc;
            hdc = BeginPaint(hwnd, &ps);

            GetClientRect(hwnd, &rc);
            SetTextColor(hdc, RGB(240,240,96));
            SetBkMode(hdc, TRANSPARENT);
            DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER);

            EndPaint(hwnd, &ps);
            break;
        }

        // ----------------------- let windows do all other stuff
        default:
            return DefWindowProc(hwnd, message, wParam, lParam);
    }
    return 0;
}

//+---------------------------------------------------------------------------
//
//  Function:   WinMain
//
//  Synopsis:   standard entrypoint for GUI Win32 apps
//
//----------------------------------------------------------------------------
int APIENTRY WinMain(
                HINSTANCE hInstance,
                HINSTANCE hPrevInstance,
                LPSTR     lpCmdLine,
                int       nCmdShow)
{
    MSG msg;

    WNDCLASS wc;

    HWND hwnd;

    // Fill in window class structure with parameters that describe
    // the main window.

    ZeroMemory(&wc, sizeof wc);
    wc.hInstance     = hInstance;
    wc.lpszClassName = szAppName;
    wc.lpfnWndProc   = (WNDPROC)WndProc;
    wc.style         = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW;
    wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);

    if (FALSE == RegisterClass(&wc)) return 0;

    // create the browser
    hwnd = CreateWindow(
        szAppName,
        szTitle,
        WS_OVERLAPPEDWINDOW|WS_VISIBLE,
        CW_USEDEFAULT,
        CW_USEDEFAULT,
        360,//CW_USEDEFAULT,
        240,//CW_USEDEFAULT,
        0,
        0,
        g_hInst,
        0);

    if (NULL == hwnd) return 0;

    pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!";

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return msg.wParam;
}

//+---------------------------------------------------------------------------

//+---------------------------------------------------------------------------

void CenterWindow(HWND hwnd_self)
{
    RECT rw_self, rc_parent, rw_parent; HWND hwnd_parent;
    hwnd_parent = GetParent(hwnd_self);
    if (NULL==hwnd_parent) hwnd_parent = GetDesktopWindow();
    GetWindowRect(hwnd_parent, &rw_parent);
    GetClientRect(hwnd_parent, &rc_parent);
    GetWindowRect(hwnd_self, &rw_self);
    SetWindowPos(hwnd_self, NULL,
        rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2,
        rw_parent.top  + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2,
        0, 0,
        SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE
        );
}

//+---------------------------------------------------------------------------

Name: Anonymous 2011-10-25 1:57

#include <stdio.h>
main(){printf("helloworld");}

Name: Anonymous 2011-10-25 2:22

How is a program ``portable'' when it only runs on one OS?

Name: Anonymous 2011-10-25 3:03

>>25
different architectures of the same OS?

Name: Anonymous 2011-10-25 3:18

alert('hello world')

Name: Anonymous 2011-10-25 3:55

>>25
Windows3.1
Windows 95
Windows 98
Windows 2000
Windows XP
Windows Vista
Windows 7

Name: Anonymous 2011-10-25 5:52

Getting to 1450 bytes here with pure basic and polink/ALIGN:16 /MERGE:.code=.text /MERGE:.text=.data

Name: Anonymous 2011-10-25 6:15

..\tcc -c N.c -Wl,--oformat,binary
main(void){puts("Hello World");}
44 bytes(loading the file is an exercise for the reader)

Name: Anonymous 2011-10-25 6:16

public class q{public static void main(){System.out.print("Hello World");}

Name: Anonymous 2011-10-25 6:19

>>31
Ãþº¾^@^@^@2^@^]
^@^F^@^O ^@^P^@^Q^H^@^R
^@^S^@^T^G^@^U^G^@^V^A^@^F<init>^A^@^C()V^A^@^DCode^A^@^OLineNumberTable^A^@^Dmain^A^@^V([Ljava/lang/String;)V^A^@
SourceFile^A^@^Hlol.java^L^@^G^@^H^G^@^W^L^@^X^@^Y^A^@^KHello World^G^@^Z^L^@^[^@^\^A^@^Clol^A^@^Pjava/lang/Object^A^@^Pjava/lang/System^A^@^Cout^A^@^ULjava/io/PrintStream;^A^@^Sjava/io/PrintStream^A^@^Eprint^A^@^U(Ljava/lang/String;)V^@!^@^E^@^F^@^@^@^@^@^B^@^A^@^G^@^H^@^A^@   ^@^@^@^]^@^A^@^A^@^@^@^E*·^@^A±^@^@^@^A^@
^@^@^@^F^@^A^@^@^@^L^@  ^@^K^@^L^@^A^@ ^@^@^@%^@^B^@^A^@^@^@   ²^@^B^R^C¶^@^D±^@^@^@^A^@
^@^@^@
^@^B^@^@^@^P^@^H^@^Q^@^A^@^M^@^@^@^B^@^N

Name: Anonymous 2011-10-25 6:20

[m]User, open a text editor and type the following:
Hello World/m]

Name: Anonymous 2011-10-25 7:32


 xchg ax, bp
 mov dx, 107h
 int 21h
 ret
 db "Hello world$"


95 BA 09 01 CD 21 C3 48 65 6C 6C 6F 20 77 6F 72 6C 64 24

19 bytes

Name: Anonymous 2011-10-25 9:17

>>34
That's not not assembly.

Name: Anonymous 2011-10-25 9:31

<html>
Hello World
</html>

Name: Anonymous 2011-10-25 9:53

Obviously .COM and dos intetrupts are smaller
1.cannot: use assembler and non-portable OS APIs

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List