How to not use I/O

1
2
3
4
5
6
7
8
#include <ciso646>
#include <iostream>
using namespace std;

int main()
{
	do do do not cin, not wcin; while(not cout, not wcout); while(not clog, not wclog); while(not cerr, not wcerr);
}
Last edited on
closed account (S6k9GNh0)
Why?
computerquip wrote:
Why?
http://ideone.com/0D1oYm
Last edited on
Is this a joke?
Sorry for my lack of humor.
closed account (S6k9GNh0)
3MB executable that does nothing... the horror...
1.6MB here. What compiler did you use? I've got clang with nuwen MinGW has the backend.
closed account (S6k9GNh0)
ideone posts executable size
You forgot to #include <ciso646>, which is actually necessary on some compilers (notably MS's) to use operator synonyms.
Fixed.
http://www.cplusplus.com/reference/ciso646/

In C++, reserved words exist with the same names as these macros and are treated as aliases of their respective operator. Therefore the inclusion of this header has no effect in C++, and is not necessary in order to use the alternative names.


Now change it back!
http://en.cppreference.com/w/cpp/header/ciso646
Duoas and cppreference wrote:
It may still be required in order to have the alternative operator representations in old or non-conformant compilers.
Like MSVC.

Now, this is how to not write the hello world program:
1
2
3
4
5
6
#include <iostream>

int main()
<%
	std::cout << "Hello, World!" << std::endl;
??>
http://ideone.com/Ztx9nD
Last edited on
How about:
1
2
3
4
5
6
#include <iostream>
 
int main()
{
    std::endl(operator<<(std::cout, "Hello, World!"));
}

http://ideone.com/B86QC6
I know about ADL, unlike Stroustrup ;)
http://stackoverflow.com/q/18086292/1959975
Our very own Lachlan Easton confirms the content of the book ;)
Last edited on
Topic archived. No new replies allowed.