So today is "make a terrible comic day"...

Hmm....

:blobcatthinking: Most terrible thing that I can draw

@vaporeon_ :

@wallhackio C++ rage comic where Vaporeon can't handle C++ sounds fun to draw

Send me some awful C++ constructs for inspiration

@vaporeon_ I don't know what this is doing but it looks evil:

const char* seed = "random seed";
RAND_seed(seed, sizeof(seed));

The following snippet which assigns to an rvalue, something you're not supposed to be able to do:

#include <iostream>
class A{};
int main() {
const A a;
std::cout << &(A() = a) << "\n";
}

using the ternary operator to conditionally change what variable is assigned to:

int main() {
int a;
int b;

// do stuff, also assign to a and b

(a < b ? a : b) = 3;
}

The following is actually valid C++ code:

https://www.google.com

Operator overloading lets you do plenty of absurdities. You could, for example, override <= such that it behaves like a "move assignment":

class A {
public:
int num;

A& operator<=(A& other) {
this->num = other.num;
return *this;
}
};

int main() {
A a;
A a2;

a.num = 1000;

a2 <= a; // move a's content to a2
};

There's certainly more but this is plenty of evil shit.

@wallhackio How is the Google URL valid code? :psyduck:

$ echo https://www.google.com > test.cpp
$ g++ test.cpp
test.cpp:1:1: error: 'https' does not name a type
1 | https://www.google.com
| ^~~~~

@vaporeon_ i must be misremembering what i saw. i'm trying to find it but i can't. for now just forget about that one

Follow

@vaporeon_ maybe it needs to be in the main function

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.