On 06/02/2017 12:21 PM, bob by wrote: > 2017-06-02 16:05 GMT+04:00 JonY <[email protected]>: > >> On 06/02/2017 11:47 AM, bob by wrote: >>> Wonder why including <iostream> bloats my exe file so much (extra 900 >> KiB, >>> with statically linked libraries), even if nothing from there is used. >> Why >>> cout requires so much code. >>> >> >> It includes static initializer code to initialize all the std::* >> members, so you are increasing code size by merely including the header. >> > > Can I get more info, what exactly it does and why I need it? >
Because the standard say the user is not responsible for initializing it, someone has to, so it falls to the compiler. > >> >>> I downloaded gcc-6.3.0 source code, and found libstdc++-v3\src\c++11 >>> folder. I guess the "cout <<" is somewhere in here, but I'm not sure >> where >>> to look. Here is the full function name that my debugger is looking for: >>> >>> std::basic_ostream<char, std::char_traits<char> >& std::operator<< >>> <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >>>> &, char const*) >>> >>> Can somebody here write a replacement for the standard cout, that will be >>> able to print strings and integers, and internally will just redirect to >>> puts and itoa? I'm only starting with C++, I'm not sure how to do it. >> >> I suppose you want to just use printf. >> > > Aint cout is more safe? I will never write a wrong % code, and it's just > more compact. Plus it will allow for compile time checks, instead of > runtime only like with printf. Not really, cout would just use whatever format underneath by guessing with the width of the input you gave it. printf too has had compile time checks for quite some time now.
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
