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

Pages: 1-4041-

/prog/ challenge [extreme edition]

Name: Anonymous 2013-01-31 15:36

Write a program that displays "Hello world" (without quotes) to the screen.

Name: Anonymous 2013-01-31 15:40

This just gave me an idea.

Name: Anonymous 2013-01-31 15:47

So you mean we can't absolutely use any quotes in the source code? That's interesting.

Name: Anonymous 2013-01-31 15:59

>>3
Even that is easy.

Name: Anonymous 2013-01-31 16:02

++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
What's my prize?

Name: Anonymous 2013-01-31 16:05

>>5
A free dick mutilation.

Name: Anonymous 2013-01-31 16:44

>>5
Move aside brainfuck!

Name: Anonymous 2013-01-31 17:47


#!/usr/bin/tail -n1

Hello, World!

Name: Anonymous 2013-01-31 17:50

>>8
GENIUS

Name: Anonymous 2013-01-31 18:08

#include <stdio.h>
int main(int argc, char ** argv)
{
     printf("Hello" " " "world");
     return 0;
}

Name: Anonymous 2013-01-31 18:35

#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
class PrintClass
{
public:
    PrintClass();
    ~PrintClass();
    char * strPrint;
}

PrintClass::~PrintClass()
{
    ; // so it does nothing. Thanks Tim!
}
// string must never be longer than 2^32!
PrintClass::PrintClass(char * argument)
{
    strPrint = (char *)malloc(4294967296 * sizeof(char*) + 1); //large enough for any usage :)
//now to store the string for printing
    strPrint = &argument; // points at to argument
    cout << strPrint; // print
}

int main()
{
    PrintClass * d = new PrintClass("Hello World!");
    return 0;
}

Name: Anonymous 2013-01-31 18:38

>>10-12
Both of you pitiful fools have used quotes. And here, you forgot this: /n

Name: Anonymous 2013-01-31 18:41

Good NOW DO IT WITHOUT YOUR STINKING SIDE EFFECTS

Name: Anonymous 2013-01-31 18:43

>>12
This, even: \n

Name: Anonymous 2013-01-31 18:50

>>12-14
\n's not in the spec!

Name: Anonymous 2013-01-31 18:53

>>15
I am >>12,14, I do not wish to be confused with the Redditor >>13.

Name: Anonymous 2013-01-31 19:10

>>12
Damn, you were right (though your citations were not)!
!!! URGENT HOTPATCH VERSION TWO EVERYBODY UPDATE !!!
#include <windows.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <stdarg.h>
using namespace std;
class ByteClass
{
public
    ByteClass(unsigned int len, ...);
    ~ByteClass();
    char * ConvertByteClassBytesToChars(int len);
    unsigned int * bytes;
}
ByteClass::~ByteClass()
{
    ;
}

ByteClass::ByteClass(unsigned int len, ...)
{
    bytes = (unsigned int *)malloc(len * sizeof(unsigned int *) + 1);
    va_list ap;
    va_start(ap, len); // ???
   
    for(int i = 0; i <= len - 1; i++)
    {
        bytes[i] = (char) va_arg(ap, unsigned int); //???
    }
    va_end(ap);
}
char * ByteClass::ConvertByteClassBytesToChars(int len)
{
    char * chars = (char *)malloc(4294967296 * sizeof(char*) + 1);
    for (int i = 0; i <= len - 1; i++)
    {
        chars[i] = (char) bytes[i];
    }
    return chars;
}

class PrintClass
{
public:
    PrintClass();
    ~PrintClass();
    char * strPrint;
}

PrintClass::~PrintClass()
{
    ; // so it does nothing. Thanks Tim!
}
// string must never be longer than 2^32!
PrintClass::PrintClass(char * argument)
{
    strPrint = (char *)malloc(4294967296 * sizeof(char*) + 1); //large enough for any usage :)
//now to store the string for printing
    strPrint = &argument; // points at to argument
    cout << strPrint; // print
}

int main()
{
    ByteClass b = new ByteClass(0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00);
    PrintClass * d = new PrintClass(ConvertByteClassBytesToChars(1000));
    return 0;
}

Name: Anonymous 2013-01-31 21:01

>>10
I count 6 quotes there!

>>11
I count 2 quotes there!

>>17
Finally!

Name: Anonymous 2013-01-31 21:57

>>17
Beautiful! You have inspired me to relearn C++ and start porting random programs to it. Thanks Bjarn.

Name: Anonymous 2013-01-31 23:45

section .rodata
hstr: db 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20 ,0x77, 0x6f, 0x6c, 0x72, 0x64, \
         0x21, 0x0a
section .text
global _start
_start:
    mov rax, 1
    mov rdi, 1
    mov rsi, hstr
    mov rdx, 13
    syscall
    mov rax, 60
    xor rdi, rdi
    syscall

Name: Anonymous 2013-01-31 23:53

>>17
#include <windows.h>
*grabs vomit*

Name: Anonymous 2013-02-01 0:28

>>20
section .rodata
Fuck off.

>>21
Keep reading, it gets better.

Name: Anonymous 2013-02-01 1:03

>>22
Whats wrong with .rodata?

Name: Anonymous 2013-02-01 1:10

#include <stdint.h>
#include <iostream>

int main(int argc, char const *argv[])
{
    uint8_t hello[11] = {72,101,108,108,111, 32, 119, 111, 114, 108, 100};  
    for(int i = 0; i < 11; i++){
        std::cout <<  static_cast<char>(hello[i]);
    }
    std::cout << std::endl;
    return 0;
}

Name: Anonymous 2013-02-01 1:13

ro ro ro ro rodata, gently down the cache,
immutably immutably immutably, life is but shared access.

Name: Anonymous 2013-02-01 2:40

#include <stdio.h>
#define STR(x)    #x
int
main(void)
{
    printf(STR(Hello world%c), 0x0a);
    return 0;
}

Name: Anonymous 2013-02-01 3:23

class HelloWorld {
    public static void main(String[] args) {
        System.out.writeln("Hello, world")
    }
    }

Name: Anonymous 2013-02-01 4:48

>>26
Shit compiles. I knew it was possible with hex with a define, but I did not know you can call the input for prinf()'s output. Thanks

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-02-01 4:49

main() {
 printf("\"Hello world\" (without quotes)");
}

Name: Lambda Arthur Calculus 2013-02-01 4:53

>>29
DA STANDARD DUZN'T GUARANTEE DAT STDOUT IS CONNECTED TO A SCREEN. ALSO, DA STANDARD REQUIRES DA RETURN TYPE OF main TO BE INT, AND U GOTTA INCLUDE stdio.h.

Name: Anonymous 2013-02-01 6:11

>>28
I knew it was possible with an integer literal and a #define, but I did not know you could use preprocessed tokens as arguments for printf(3) (or any other function).
FTFY.

Name: Anonymous 2013-02-01 6:17

>>31
Thanks again, still drunk.

Name: A beautiful hello world 2013-02-01 7:43

    import java.io.OutputStreamWriter
;   import java.io.BufferedWriter
;   public class HelloWorld
{   public static void main(String[]commandLineArguementStringArray)
{   char[]charArrayHelloWorld=new char[]
{   72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100
}
;   OutputStreamWriter printToStdout=new OutputStreamWriter(System.out)
;   BufferedWriter bufferedOutputPrint=new BufferedWriter(printToStdout)
;   int iterator=0
;   int helloWorldArrayLength=charArrayHelloWorld.length
;   while(iterator<helloWorldArrayLength)
{   char currentCharacter=charArrayHelloWorld[iterator]
;   try
{   bufferedOutputPrint.write(currentCharacter)
;  
}   catch(java.io.IOException inputOutputException)
{   inputOutputException.printStackTrace()
;
}   iterator=iterator+1

}   try
{   bufferedOutputPrint.flush()
;   printToStdout.flush()
;   bufferedOutputPrint.close()
;   printToStdout.close()
;
}   catch(java.io.IOException inputOutputException)
{   inputOutputException.printStackTrace()
;
}   return
;
}
}

Name: Anonymous 2013-02-01 12:51

#include <stdio.h>

#define a main
#define program ()
#define that {
#define prints printf(
#define without );
#define quotes return
#define to 0
#define the ;
#define screen }

typedef int Write;

Write a program that prints "Hello world" without quotes to the screen

Name: Anonymous 2013-02-01 17:04

a program that displays "Hello world" (without quotes) to the screen.

Name: Anonymous 2013-02-01 17:05

file: hello_world.h
/* /prog/ C Standard: 2013-01 <hello_world.h>, v0.1 */
/* Copyright (C) 2013 /prog/ libc Foundation, Inc.
   This file is part of the /prog/ C Library.

   The /prog/ C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The /prog/ C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the /prog/ C Library; if not, see
   <http://www.gnu.org/licenses/>;.
   */
#ifndef PROG_HELLO_WORLD_H
#define PROG_HELLO_WORLD_H
/* Prints "Hello world" (without the quotes) on to the screen. /prog/ C standard
 * 201301 defines quotes as harmful characters. The standard says that
 * "Hello world" should be printed without quotes, and is ambigous in whether it
 * should be in the source code or not. The standard does not define how the
 * string is initialized, nor the presence of EOL after the string, nor it's
 * return value. Returns 0 if "Hello world" is successfully printed,1 on
 * failure.
 */
extern int hello_world(int, char **);
#endif

#if __PROGCSTD__ < 201301
#define hello_world(x, y)    0
#endif


file: hello_world.c
/* /prog/ C Standard: 2013-01 <hello_world.c>, v0.1 */
/* Copyright (C) 2013 /prog/ libc Foundation, Inc.
   This file is part of the /prog/ C Library.

   The /prog/ C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The /prog/ C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the /prog/ C Library; if not, see
   <http://www.gnu.org/licenses/>;. */
#include <hello_world.h>
#include <stdio.h>
#include <string.h>

#undef safeprint
#undef safestrcmp
#undef hello_world

/* we use printf(3) and strcmp(3) which allow string literals to passed as
 * arguments. These macros are temporary workarounds for when printf and strcmp
 * become /prog/ C standard compilant.
 */
#define safeprintf(x, ...)    printf(#x, __VA_ARGS__)
#define safestrcmp(x, y)    strcmp(#x, y)

int hello_world(int n, char **src) {
    /* This eliminates all quotes */
    if(n == 3) {
        /* we only want to print "Hello world" */
        if(safestrcmp(Hello, src[1]) == 0
        && safestrcmp(world, src[2]) == 0)
            if(safeprintf(%s %s, src[1], src[2]) < 0) return 1;
        else return 1;
    }
    else return 1;
    putchar(10);
    return 0;
}

Name: Anonymous 2013-02-01 17:10

>>36
Best answer so far.

Name: Anonymous 2013-02-01 17:11

>>36
Usage:
#include <hello_world.h>
int main(int argc, char **argv) {
    return hello_world(argc, argv);
}

Name: Anonymous 2013-02-01 17:20

>>36
hello_world.c-0.2.patch
--- hello_world.c.orig    2013-02-02 03:18:40.534394992 +0500
+++ hello_world.c    2013-02-02 03:15:34.768675391 +0500
@@ -37,6 +37,7 @@
         if(safestrcmp(Hello, src[1]) == 0
         && safestrcmp(world, src[2]) == 0)
             if(safeprintf(%s %s, src[1], src[2]) < 0) return 1;
+            else ;
         else return 1;
     }
     else return 1;

Name: Anonymous 2013-02-01 17:39

>>36,38-39
GNU quality shitware.

Name: Anonymous 2013-02-01 21:12

>>36
Your implementation is unsuitable for the GNU project. Where's the --help option? The Unicode support? The dynamic memory allocation?

Name: Anonymous 2013-02-01 21:29

>>41
It is not a program by itself, but a library function, part of the /prog/ C Standard Library. The implementation of how the arguments passed to the program are handled is left up to the programmer. Also note that /prog/ C Standard Library has no relation whatsoever to the GNU project, other than the license it is released under. Please read the manpage before presenting issues. If the copy presented to you does not have the associated manpages, refer to http://man.your-an.us/3/hello_world.html. Thank you for your time.

Name: Anonymous 2013-02-01 21:32

>>42
Shalom!

Name: Anonymous 2013-02-02 1:58

>>41
As long as its GPL3 compatible, it'll be fine for the GNU project. It shouldn't be much effort to change to fit the expected GNU standard.

Name: Anonymous 2013-02-02 2:06

>>44
(L)GPL2 isn't (L)GPL3 compatible.

Name: Anonymous 2013-02-02 2:08

>>45
both are shit

Name: Anonymous 2013-02-02 4:10

>>25
Funny, but you put a few too many ro's for it to work lyrically.

Name: Anonymous 2013-02-02 4:17

>>47
It would have been too messed up that way.

Row _ Row Row _ the boat _ _ gently down the stream
ro _ ro ro _ da ta _ _ ....

ro, no longer attached to data.

Name: Anonymous 2013-02-02 4:26

>>48
Spaces are added during expansion; ragnarok online, ragnarok online, rangnarok online data

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