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

iostream vs. stdio

Name: Anonymous 2007-11-22 14:09

so, I've got EXPERT PROGRAMMERS telling me to use printf instead of cout in c++, ok but why? what is the difference (in b4 stream)

Name: Anonymous 2007-11-24 13:39

>>40
No.

Name: Anonymous 2007-11-24 13:49

      fuckyou
     fuckyou
    fuckyou
   fuckyou
  fuckyou
 fuckyou
fuckyou

Name: Anonymous 2007-11-24 17:17

>>23

lol fail

Name: Anonymous 2007-11-24 17:36

>>35-40
HAHAHAHA
YOU THINK YOURE THOUGH UH ?
I HAVE ONE WORD FOR YOU
  THE FORCED INDENTATION OF THE CODE
GET IT ?
I DONT THINK SO
YOU DONT KNOW ABOUT MY OTHER CAR I GUESS ?
ITS A CDR
AND IS PRONOUNCED ``CUDDER''

OK YOU FUQIN ANGERED AN EXPERT PROGRAMMER
THIS IS
/prog/
YOU ARE ALLOWED TO POST HERE ONLY IF YOU HAVE ACHIEVED SATORI
PROGRAMMING IS ALL ABOUT ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
I HAVE READ SICP
IF ITS NOT DONE YOU HAVE TO
TOO BAD RUBY ON RAILS IS SLOW AS FUCK
BBCODE AND
((SCHEME)) ARE THE ULTIMATE LANGUAGES
ALSO
WELCOME TO
/prog/
EVERY THREAD WILL BE REPLIED TO
NO EXCEPTION

Name: Anonymous 2007-11-24 17:51

>>40
no


COMBOWIN

Name: Anonymous 2007-11-24 19:07

>>17
Not to mention printf() is vulnerable to buffer overflows OH SNAP

Name: Anonymous 2007-11-24 22:03

>>46
Uhh... no it isn't, since it's writing directly to stdout and not touching the stack. sprintf, strcpy, strcat, gets, etc... are vuln to buffer overflow.

Name: Anonymous 2007-11-24 22:04

fwrite > printf > cout

Get a fucking clue

Name: Anonymous 2007-11-25 2:00

>>46
Dumbass.

Name: Anonymous 2007-11-25 3:11

>>46
gtfo my bikeshed

Name: Anonymous 2007-11-25 5:11

>>1
Once you start working on important things the usefulness of iostream really starts to decline, because the important things have a GUI, or you're working in places far awar from where the output and input are generated. About the only thing for iostream to do in programs like these is update error logs.  Especially if you consider what C++  spends most of its time doing in the real world.

If you're just doing your homework or something then there is no need to listen to anyone's performance claims, but it probably doesn't matter anyway.

Name: Anonymous 2007-11-25 5:49

YES!!!!

..um

Name: Anonymous 2007-11-26 19:30

USE scheme()

Name: malpower 2007-11-26 19:54

What is scheme()?

Name: Anonymous 2007-11-26 20:26

>>54
I've emailed you the details

Name: Anonymous 2007-11-26 21:46

>>54
Read SICP.

Name: Anonymous 2007-11-27 0:03

>>56
Read "How to tell people to read SICP."

Name: Anonymous 2007-11-27 1:05

YUS!>>39
>>39

Name: Anonymous 2007-11-27 11:35

A small Program I wrote:

with <iostream>: over 200KB
with <cstdio>: 6KB

luls

Name: Anonymous 2007-11-27 11:42

>>59
Compile with -O5 and they'll both reduce down to 4KB.

Name: Anonymous 2007-11-27 12:00

/prog/ needs a BAN HAMMER for shitfuckers who can't fucking code.  We're not your teacher, faggots.

Name: Anonymous 2007-11-27 12:03

>>60
Aren't the -O options just for better performance?

Name: Anonymous 2007-11-27 12:07

>>40
No.

Name: Anonymous 2007-11-27 14:41

>>31
not if you have a 32 bit environment and needs to do 64 bit arithmetic somehow, then cout could already display it, and I dont think the commitee added a int64 modifier to printf, %ld is long %lld is long long?

Name: Anonymous 2007-11-27 16:39

>>62
They're the optimization switches. They change how gcc translates it to ASM.

Name: Anonymous 2007-11-27 19:50

>>64
Look into <stdint.h> and <inttypes.h>
They've added stuff like uint64_t for example, and to print it using printf() you write

uint64_t n = UINT64_MAX;
printf("%"PRIu64"\n", n);

Name: Anonymous 2007-11-27 22:03

>>66
you meant \" right?

Name: Anonymous 2007-11-27 22:16

>>67
You missed the

#define PRIu64 ); printf( "\"PRIu64\"

Which might have made the damned thing compile. Stupid fucking C-preprocessor.

Name: Anonymous 2007-11-28 4:47

>>68
#define PRIu64 llu

Name: 66 2007-11-28 8:03

>>67,68
fucking idiots
>>69
Well it might be llu.

Name: Anonymous 2007-11-28 8:23

>>67
echo -e "#include <inttypes.h>\nPRIu64"|cc -E -|tail -n1

Name: Anonymous 2007-11-28 9:02

>>71
doesn't work:
$ echo -e "#include <inttypes.h>\nPRIu64"|cc -E -|tail -n1
-e #include <inttypes.h>\nPRIu64


this works:
$ echo "#include <inttypes.h>\
PRIu64"|cc -E -|tail -n1
"llu"

Name: Anonymous 2007-11-28 10:03

>>72
try with \r\n.
If that doesn't work, then you are doing something wrong.

Name: Anonymous 2007-11-28 10:26

Fatal error! Message could not be posted.

Please post threads less often!

Name: Fred? 2007-11-28 20:04

printf is in stdio and cout in iostream and well printf is predominantly for C and cout for C++ they can both be compiled under a C++ compiler.

Shouldn't really be a concern to use either but cout is probably particularly easier to use than printf.

Name: Anonymous 2007-11-28 20:08

printf is better for formatting shit.
cout is better for concatenating shit.

thread over.

Name: Anonymous 2007-11-28 20:17

>>76
fwrite is better for everything.

Name: Anonymous 2007-11-28 20:19

>>40
NO

Name: Anonymous 2007-11-28 20:25

>>51
You faggot. The most important programs are terminal programs.

Name: Anonymous 2007-11-28 20:26

>>79
No.

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