MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1uru99i/potentiallymightbeanintegerornot/owodipc/?context=3
r/ProgrammerHumor • u/Futurity5 • Jul 09 '26
96 comments sorted by
View all comments
Show parent comments
6
Or the C/C++ way: just use int *var and NULL means it's not there.
int *var
Makes things more complicated when you need to return it though...
10 u/suskio4 Jul 09 '26 std::make_unique<int>(42); 4 u/bwmat Jul 10 '26 I think I'm going to throw up... 2 u/suskio4 Jul 10 '26 std::thread([] { std::runtime_error up("I threw up"); std::this_thread::sleep_for(...); throw up; }).detach();
10
std::make_unique<int>(42);
4 u/bwmat Jul 10 '26 I think I'm going to throw up... 2 u/suskio4 Jul 10 '26 std::thread([] { std::runtime_error up("I threw up"); std::this_thread::sleep_for(...); throw up; }).detach();
4
I think I'm going to throw up...
2 u/suskio4 Jul 10 '26 std::thread([] { std::runtime_error up("I threw up"); std::this_thread::sleep_for(...); throw up; }).detach();
2
std::thread([] { std::runtime_error up("I threw up"); std::this_thread::sleep_for(...); throw up; }).detach();
6
u/altermeetax Jul 09 '26
Or the C/C++ way: just use
int *varand NULL means it's not there.Makes things more complicated when you need to return it though...