cowsay

Random things go here

Re: cowsay

Post by 0phidian on Wed Apr 16, 2014 9:34 am
([msg=80281]see Re: cowsay[/msg])

Adrasteia the Inescapable wrote:That's useful to know. Is there a list of which standard libraries include which others?


What Ninjex said. It is best practice to go ahead and include string though. It will not work for all compilers just because it's included elsewhere.
User avatar
0phidian
Poster
Poster
 
Posts: 266
Joined: Sat Jun 16, 2012 7:04 pm
Blog: View Blog (0)


Re: cowsay

Post by -Ninjex- on Wed Apr 16, 2014 9:49 am
([msg=80282]see Re: cowsay[/msg])

0phidian wrote:
Adrasteia the Inescapable wrote:That's useful to know. Is there a list of which standard libraries include which others?


What Ninjex said. It is best practice to go ahead and include string though. It will not work for all compilers just because it's included elsewhere.


Keep in mind that sometimes you don't want to include the entire library either, as it could bring in a bunch of junk you don't need.
For example, if you want to print something to the console twice, it's not worth including the entire file (such as iostream or stdio), which will also bring in at least 30 other functions too. It would be best just to look in the global namespace using the scope-resolution operator :: like so: std::cout
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1246
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Post by pretentious on Wed Apr 16, 2014 9:57 am
([msg=80283]see [/msg])

0phidian wrote:What Ninjex said. It is best practice to go ahead and include string though. It will not work for all compilers just because it's included elsewhere.

Yeah I've been bitten a few times by it.
Code: Select all
vector<string> strings;

g++ will give me shit and i'm looking at my 6 whole lines of code for like 5 minutes, thinking 'WHAT DO YOU WANT FROM ME!! :x '
-Ninjex- wrote:For example, if you want to print something to the console twice, it's not worth including the entire file (such as iostream or stdio), which will also bring in at least 30 other functions too. It would be best just to look in the global namespace using the scope-resolution operator :: like so: std::cout

Fun fact: a hello world program i made in ASM was 61 bytes as an executable and the equivelant in C is 976 bytes. That's what 1 library being linked?
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
pretentious wrote:Welcome to bat country
User avatar
pretentious
Contributor
Contributor
 
Posts: 624
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Previous

Return to Off-Topic

Who is online

Users browsing this forum: No registered users and 0 guests