Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

printf vs cout

Name: Anonymous 2008-04-06 9:03

y halo that /prog/,
why does it seem that everyone uses printf and scanf instead of their counterparts cout and cin?

Name: Anonymous 2008-04-06 9:07

Everyone probably should use cout and cin, but habbit and stubborness keep people using the same tools they always have. I do it too.

Name: Anonymous 2008-04-06 9:21

>>2
Everyone probably should use cout and cin,
Even C programmers?
Even when printf/scanf are more appropriate?

You're a moron >>2.

Name: Anonymous 2008-04-06 9:32

Because using OO for simple IO is for sillies.

Name: Anonymous 2008-04-06 9:32

>>3
Obviously not C programmers, dickwad.

Name: Anonymous 2008-04-06 9:46

>>4
simple IO
This is just in: IO is simple!
>>5
Obvious is subjective.

Name: Anonymous 2008-04-06 9:50

>>6
simple IO != IO is simple

Sillybuns.

Name: Anonymous 2008-04-06 9:56

Because the C++ I/O system is made of bloat, fail and bitshifts.

Name: Anonymous 2008-04-06 10:02

so much anger...

Name: Anonymous 2008-04-06 10:04

>>8
C++ I/O is made of many less buffer overruns and such.

Name: Anonymous 2008-04-06 12:08

>>10
cout << "enter naem: " << flush;
char buf[10];
cin >> buf;


cin >> is scanf, with the same problems.

Name: Anonymous 2008-04-06 12:38

Stroustrup is the greatest troll ever. Who the fuck would overload bitwise operators for I/O?

Name: Anonymous 2008-04-06 12:48

>>12
3/10

Name: Anonymous 2008-04-06 12:51

>>13
[i]0.3[i]

Name: Anonymous 2008-04-06 12:53

>>11
Not at all. It adds things like incredibly retarded error handling.

Name: Anonymous 2008-04-06 13:05

>>11
It has the same problem as scanf because you're raping it with a C-ism (statically-allocated string buffers). Replacing that with a string --

std::cout << "Have you read SICP today?\n>" << std::endl;
std::string response;
std::cin >> response;


fixes the buffer overflow problem.

That said, Sepple's stream-based approach to IO creates some really retarded semantics, especially with regards to formatting, whitespace consumption, etc. ``Stream Manipulators'' are really retarded.

Back to C, please.

Name: Anonymous 2008-04-06 14:41

>>16
lol heap memory allocation

If you want your program to be small and fast, you use C, without all that ``std::string response;'' ass-slow magic.
If you want your program to be easy to write, you use normal language, not this monstrosity.

Name: Sgt.Kabukiman 2012-05-21 14:07

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List