[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
C++ preference
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 21
Thread images: 1
File: 1296043246100F-5a09.jpg (99 KB, 480x800) Image search: [Google]
1296043246100F-5a09.jpg
99 KB, 480x800
Hey /g/, I'm currently doing Object Oriented C++ in my Electronics Engineering degree. Currently we're told to use printf functions for all our programs but I've noticed that most programmers online use their namespace std function instead. Tell me your preference and why you prefer it over the other.
>>
>>54626435
System.out.println("Hello Word");
>>
C++ stringstreams are one of the most retarded things to come out of that clusterfuck of a language. Formatted printing is infinitely better.
>>
>>54626435
I use my own c style string class. anything that is not open source is a potential spying tool and should be avoided at all costs. unless the strings you are using are own source and you yourself have rad the code, dont trust it.
>>
There might be some advantages to using printf(), but I find the format specifiers difficult to remember, and I find std::cout makes it much easier to concatenate strings for output. I'm also told it's more secure than printf(), though I'm not entirely sure what is meant by that.
>>
std::cout
Don't let pajeet teach you how to write programs, you'll only end up like him
>>
>>54626496
Siddharta Rao is one of the best developers in the world
>>
>>54626473
How could a printf function be used as a spying tool? Can you give me an example?
>>
>>54626492
>but I find the format specifiers difficult to remember
For 95% of the usage, all you need to remember is %s and %d.
>I find std::cout makes it much easier to concatenate strings for output
printf("%s %s\n", str1, str2);

std::cout << str1 << " " << str2 << std::endl;

>also told it's more secure than printf(), though I'm not entirely sure what is meant by that.
The only insecurity of printf is if you allow untrusted user input to be used as a format string. Just don't do that and printf is completely secure.
>>
>>54626435
printf because it's much more intuitive than those weird streams to me, plus it's easier to format. The whole
 std::cout << "Hello World"; 
formatting just looks weird to me. What's even up with the syntax there? It makes no sense to me, at least not intuitively. Can you even do stuff like
 printf ( "\r%3.1f %% finished", 100.0 * ( float ) k / ( float ) max ); 
with streams? I imagine it would look terrible in comparison. Anyway, I use that a lot.

Then again I usually just program in C without the ++, but I heard of a lot of people who despise std::cout.
>>
>>54626530
You much be his cousin, only a relative of an Indian would call an Indian "developer" good
>>
>>54626451
Wouldn't
Printf("Hello World"); be easier to remember? and to me it looks a bit neater.
>>
>>54626534
The compiler sends important information that you are printing to servers. For example, when using an obscure library one time without peaking through my code i noticed that I got malware invested on my computer
>>
>>54626534
you wouldnt understand, script kiddy
>>
>>54626558
My prof believes this too, he only told me that printf is neater and eaiser to format but is "less professional".
>>
>>54626580
Ohhh I understand. Cheers
>>
>>54626580
>>54626534
If you can't even trust your own libc, why the fuck are you even using whatever operating system you're using?
>>
>>54626650
I am using templeOS and I have read the code. Since it is ring 0 there is no networking and i am not being spyed on.
>>
>>54626677
i also use templeos and am amazed at how secure and easy to use is. unlocked ring 0 is definitely the way to go, fuck the niggers trying to lock it from us
>>
>>54626454
This.
>>
>>54626451
Isn't that java syntax dude?
Thread replies: 21
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.