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.
>>54626435System.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 outputprintf("%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 wholestd::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 likeprintf ( "\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?