Discuss Scratch

theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

Have you ever seen some ridiculously stupid code?

I've seen lots of it, and, quite frankly, I find it hilarious

I wanted to share some here:
#define PROCESS_AND_RETURN(X) \
X.process(); \
// Important: Return only after invoking virtual method process() \
return X
^^ the best macro I have ever seen

What can you come up with ?
ChocolatePi
Scratcher
1000+ posts

What's the funniest code we can think of?

#define if while
#define bool string
#define main slkjfldksjelkfj

also this

Exception up = new Exception("Something is really wrong.");
throw up;  //ha ha

Last edited by ChocolatePi (Dec. 16, 2014 19:35:29)

theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

This one is from C++, another macro:
#include <iostream>
#define System S s;s
#define public
#define static
#define void int
#define main(x) main()
struct F{void println(char* s){std::cout << s << std::endl;}};
struct S{F out;};
/* this guy's a genius... */
public static void main(String[] args) {
  System.out.println("Hello World!");
}

Last edited by theonlygusti (Dec. 16, 2014 19:43:25)

ChocolatePi
Scratcher
1000+ posts

What's the funniest code we can think of?

I just updated my post
ChocolatePi
Scratcher
1000+ posts

What's the funniest code we can think of?

// sometimes I believe the compiler ignores all my comments

#define TRUE FALSE
    //Happy debugging suckers
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

ChocolatePi wrote:

// sometimes I believe the compiler ignores all my comments

#define TRUE FALSE
    //Happy debugging suckers
I once saw this:
#define TRUE 0
for real, it was so the person could say
if (function_which_returns_zero_on_success(x) == TRUE){
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

#define ever (;;)
for ever {
//...
}

^^ this guy is a genius
QuillzToxic
Scratcher
1000+ posts

What's the funniest code we can think of?

<script type=“text/javascript” async src="http://cdn.delphitools.info/wp-content/uploads/2013/10/jsbat.js?1.2"></script>
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

I'm now going to try and turn C into written Scratch:

#define when_gf_clicked main(int argc,char**argv){
#define repeat_until(c) while (!(c)){
#define end }
#define then {
#define say(s) fprintf(s);
when_gf_clicked
if (1 < 2) then
repeat_until(1 != 1)
say("Hi")
end
end

Ta da!
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

QuillzToxic wrote:

<script type=“text/javascript” async src="http://cdn.delphitools.info/wp-content/uploads/2013/10/jsbat.js?1.2"></script>
Sorry, you got the wrong topic: this ought to go in the Obfuscated Code Contest…

I couldn't stop laughing at this guy's genius! So funny!
technoboy10
Scratcher
1000+ posts

What's the funniest code we can think of?

rm -rf /
Don't try this at home (no, really).
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
theonlygusti
Scratcher
1000+ posts

What's the funniest code we can think of?

public int GetRandomNumber(maxNum) {
    return 12;
}
goldfish678
Scratcher
1000+ posts

What's the funniest code we can think of?

theonlygusti wrote:

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
I'm pretty sure that's Batch.
technoboy10
Scratcher
1000+ posts

What's the funniest code we can think of?


goldfish678 wrote:

theonlygusti wrote:

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
I'm pretty sure that's Batch.
*bash

It's Linux shell code. It erases your hard drive.

Last edited by technoboy10 (Dec. 16, 2014 20:56:11)

ChocolatePi
Scratcher
1000+ posts

What's the funniest code we can think of?

technoboy10 wrote:

goldfish678 wrote:

theonlygusti wrote:

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
I'm pretty sure that's Batch.
*bash

It's Linux shell code. It erases your hard drive.

rmdir C:\Windows\System32
PullJosh
Scratcher
1000+ posts

What's the funniest code we can think of?

theonlygusti wrote:

public int GetRandomNumber(maxNum) {
    return 12;
}
Such random. Much wow.
goldfish678
Scratcher
1000+ posts

What's the funniest code we can think of?

technoboy10 wrote:

goldfish678 wrote:

theonlygusti wrote:

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
I'm pretty sure that's Batch.
*bash

It's Linux shell code. It erases your hard drive.
Wait a second, if Windows shell code is named Batch then is Bash just a parody of Batch?
goldfish678
Scratcher
1000+ posts

What's the funniest code we can think of?

var var = var;

Last edited by goldfish678 (Dec. 17, 2014 01:29:28)

MegaApuTurkUltra
Scratcher
1000+ posts

What's the funniest code we can think of?

goldfish678 wrote:

technoboy10 wrote:

goldfish678 wrote:

theonlygusti wrote:

technoboy10 wrote:

rm -rf /
Don't try this at home (no, really).
What is that? How do we run it?
I'm pretty sure that's Batch.
*bash

It's Linux shell code. It erases your hard drive.
Wait a second, if Windows shell code is named Batch then is Bash just a parody of Batch?
No, Bash = “Bourne-again shell,” aka a better version of the classic Bourne shell (sh).
Batch = Batch script, aka running a bunch of commands at once, a batch job.
They're not related at all.

PullJosh wrote:

theonlygusti wrote:

public int GetRandomNumber(maxNum) {
    return 12;
}
Such random. Much wow.
Obligatory XKCD:


Here's my random code of the day:
int main(int argc,char**argv){
    // the following compiles successfully
    // how??/
    invalid statement derp
}
and another one
// the following doesn't work
// try it! copy and paste into inspect element
var а = "swag";
alert(a);

Last edited by MegaApuTurkUltra (Dec. 17, 2014 03:48:28)

Powered by DjangoBB