Code Insults

Pages: 12
The goal of this is to insult the general population of cplusplus.com with a piece of code.

Here's my commitment -


1
2
3
4
5
6
7
8
9
10
11
12
13
14

class YourMom
{
   void eat()
   { 
       eat(); 
   }
public:
   YourMom() 
   { 
      eat(); 
   }
};
Last edited on
@the above code and all code following:
1
2
3
4
5
6
7
#include <iostream.h>
#include <conio.h>
using namespace std;
main() {
    cout<<"That piece of code is worthless excuse for an insult.";
    getch();
}
Last edited on
Zhuge wins. At least he knows how to write elegant code that conforms to standards. C'mon OP, those brackets...
TBH, this thread is totally pointless. But here:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>

using namespace std;

class YourDad
{
private:
    void sucks(string drink);
public:
    YourDad(string drink);
};

YourDad::YourDad(string drink)
{
    sucks(drink);
    cout << "You've constructed your Dad. Good job!" << endl;
}

void YourDad::sucks(string drink)
{
    cout << "Your dad sucks the shit outta " << drink << endl;
}


(Note: This is purely a joke and no intention was made to insult anyone. )
1
2
3
4
5
6
import std.stdio;

void main()
{
    writeln("Hello users of an inferior language!");
}

@ Catfish666: I would be guessing that its D right? Good to know someone else here uses that language too.
Lol, I wrote this thread from a mobile device, so I was trying to avoid too many lines. Since you guys are so picky about something pointless I'll change it lmao.
1
2
3
4
5
6
#include <iostream>
void main()
{
    std::cout << "Hello world";
    system("pause");
}
Last edited on
I see what you did there...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <random>

int main()
{
    srand(4);
    char word[4];
    char word2[3];
    unsigned int i = 0;
    while(i != 176777)
    {
        word[0] = rand() % 26 + 65;
        word[1] = rand() % 26 + 65;
        word[2] = rand() % 26 + 65;
        word[3] = rand() % 26 + 65;
        ++i;
    }
    while(i != 215920)
    {
        word2[0] = rand() % 26 + 65;
        word2[1] = rand() % 26 + 65;
        word2[2] = rand() % 26 + 65;
        ++i;
    }
    std::cout << word[0] << word[1] << word[2] << word[3] << " " << word2[0] << word2[1] << word2[2] << "\n\n";
    return 0;
}
@Mats, AYIC IZM?
1
2
3
4
5
6
7
8
9
/*
This forum contains a lot of oversensitive pedants that will
bicker about anything. The Lounge is a toilet. C++
is a hodgepodge of bolted-on feature sets inspired by better
languages. Every time you post template code in the beginner's
forum, a child in the world is starved on purpose. Torvalds
was right about C++, and he is smarter than all of you.
*/
int main() { return 0; }

:)
1
2
3
4
5
6
#include <stdio.h>

int main(void)
{
    printf("I     STILL     EXIST!\n");
}

@Mats, AYIC IZM?


That's a shame. I was hoping each version would check the same division on the same numbers when given the same seed (why don't they?). Apparently there is variance (depending on your system?), which I didn't expect.
closed account (N36fSL3A)
@booradely

k.

-----
1
2
3
#define DO_THIS main()(return 0;)

DO_THIS
1
2
3
#include <cstdio>
double m[]= {7709179928849219.0, 771};
int main(){m[1]--?m[0]*=2,main():printf((char*)m);}


That piece of code is actually quite fun to study why it does what it does.
Last edited on
closed account (N36fSL3A)
What would be even more insulting would be this variation:

1
2
3
#include <stdio.h>
double m[]= {7709179928849219.0, 771};
int main(){m[1]--?m[0]*=2,main():printf((char*)m);}
Mats code changed to work on all compilers:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <random>

int main ()
{
    std::linear_congruential_engine<uint_fast32_t, 214013, 2531011, 2147483648> rnd(4);
    char word[5]{0};
    char word2[4]{0};
    unsigned int i = 0;
    while(i != 176777)
    {
        word[0] = (rnd() >> 16) % 26 + 65;
        word[1] = (rnd() >> 16) % 26 + 65;
        word[2] = (rnd() >> 16) % 26 + 65;
        word[3] = (rnd() >> 16) % 26 + 65;
        ++i;
    }
    while(i != 215920)
    {
        word2[0] = (rnd() >> 16) % 26 + 65;
        word2[1] = (rnd() >> 16) % 26 + 65;
        word2[2] = (rnd() >> 16) % 26 + 65;
        ++i;
    }
    std::cout << word << " " << word2 << "\n\n";
}

@Catfish
printf("I STILL EXIST!\n")
#pragma GCC poison printf //You do not exist anymore
Last edited on
Thanks MiiNiPaa!

Could you give a quick explain on why it didn't work on all compilers and your modification did?
Last edited on
rand() almost always uses linear congruental generator. Next number is calculated as xn = (axn-1 + c) % m. Values of a, c and m can vary depending on implementation. I just created an instance of LCG explicitly using constants from Microsoft Standard C Library.
MS version of C standard library is unique that it returns not least significant bits (usually 0-31 or 0-15) but most significant (starting with 16th). So I had to right shift result to get exact values.
Last edited on
Pages: 12