r/shittyprogramming • u/idontcare1025 • Mar 21 '15
Learning C++; don't want STDs
I'm trying to learn C++ but it seems every resource I can find wants me to use STDs in my programs. I don't want to forcibly infect these poor programs, what do I do?
260
u/Intrexa Mar 21 '15
STD's are viruses, if you read online someone telling you to put an STD in your program, they are trying to spread viruses. Instead, you should put this at the top of every program you write:
#define condom using //We are saying we will be using a condom; gotta be safe here
#define prevent namespace //this is kind of a legacy thing
condom prevent std;This will allow you to use cout to write things, and not have to worry about std's because the condom is preventing it.
9
u/pointychimp Mar 22 '15
I'm not sure if that was funny of if my current
drunkstate of mind made it funny. Enjoy the gold. Wow I spelled okay. I need more.Have a good day or evening /u/Intrexa.
2
u/KnightOfDark Mar 22 '15
This is a good solution, but it feels a bit like a hack. The solution suggested by the official c++ standard is quite elegant, I think - you just have to remember to declare the members of those classes you wish to be STD-free as protected - or, if you're sure that you can trust all of them, as private.
Interestingly, Java also allows you to add this guard against STD's, despite the language not itself containing any! This is to ensure that Java programs can be pipelined safely with c++ programs, but it really goes to show the lengths Oracle are willing to go to in order to help their developers. One of many reasons why you should be learning Java, not c++.
34
29
u/rbemrose Mar 21 '15 edited Jul 12 '20
This post has been removed due to reddit's repeated and constant violations of our content policy.
11
u/jP_wanN Mar 21 '15
Actually, your program can't get STDs unless it has DICSS, and I'm pretty sure that Java-type stuff isn't compatible with C++.
2
u/blickblocks Mar 22 '15
If your sexual partner's ware starts to become firm, maybe even hard, chances are you'll be interrupted before you can even pass anything to one another.
2
u/akira_hiro Mar 22 '15
Your program is going to interact with system code, and most of it already uses std. So there's nothing you can do about it. You can't get it twice anyway.
1
u/partyboy690 Mar 26 '15
As of C++11 they're no longer called STD but now STI.
Example code; using sti::gonorhea;
19
u/[deleted] Mar 21 '15
Use a condom.