@vaporeon_ did you know that std::endl not only adds a newline but also inexplicably calls a method on the underlying "output stream instance" representing the console output, meaning that writing std::cout << "Hello world" << std::endl is less performant than writing std::cout << "Hello world" << "\n";?
re: no image desc
@vaporeon_ T&& is an "rvalue reference to T" which is a whole can of worms I am not going to explain right now
@aescling @vaporeon_ lmao
@aschmitz @aescling @vaporeon_ today you are my favorite masto user who username's first syllable sounds like "ash"
@vaporeon_ someone in a reddit comment said they actually saw this in their company's production code so even if its wrong, its out in the wild somewhere
@aescling @vaporeon_ forgive me for not knowing what i am talking about
@vaporeon_ i have failed in my objective lol
@vaporeon_ lmao
@vaporeon_ it's from an openssl library: https://docs.openssl.org/1.0.2/man3/rand/
@vaporeon_ maybe it needs to be in the main function
@vaporeon_ you have already put more thought into that hack than i ever have by writing this comment
@vaporeon_ (tbh i also kinda like it)
@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
@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.
kept afloat by big ideas.
you can call me Caleb or Clodsire. i also go by clodboy and catwin. i am not picky about names (unless its one amy made up)
videogame enjoyer. mathematics hobbyist and recovering physicist. software engineer. professional wonk. prophet of The Truth. the walking embodiment of "not diagnosed, but somethings wrong". i like animals that wear cowboy hats.
number of fat cock awards received: 56
pfp is by @The_T
header is by @vaporeon_
"i regret ever allowing him here" ~aescling
"oh you're one of those weird movie likers" ~Ti
"i know your taste in movies well enough to discount your opinion" ~globin
"caleb is the only person on this websites who truly understands what the report button is for: 'i don't like this post'" ~holly
30+
straight
he/him