Results 1 to 15 of 15

Thread: <iostream> and Execuable Size

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    <iostream> and Execuable Size

    OK, before adding "#include <iostream>" to my program, the file size is 23kb, after adding it, the file size is over 450kb, is that normal??

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <iostream> and Execuable Size

    I assume you mean compiled file size, in which case the answer is yes.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    Re: <iostream> and Execuable Size

    Fark, why the hell is that?

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <iostream> and Execuable Size

    Well, because include means just that - it includes whatever is in your standard library's iostream header file (and any files #include'd from that, etc.) as if it were part of your source code.

    All convenience comes at a price.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    Re: <iostream> and Execuable Size

    Heh, I realised that, I was just wondering why it was such a huge file. What functionality is included in the iostream header anway?

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: <iostream> and Execuable Size


  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    Re: <iostream> and Execuable Size

    Thanks. Looks like I'll be avoiding this particular header in this application, i need it to be as small as possible.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: <iostream> and Execuable Size

    Bah!

    Btw, including the header should increase your exe by exactly nothing. It's using something from it, like std::cout, that increases the size.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: <iostream> and Execuable Size

    No way in hell the app should be 450kb using everything IN <iostream>
    Are you sure you're reading 450kb and not 45.0 kb ?

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: <iostream> and Execuable Size

    450k is realistic. The default setting is to link statically.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Re: <iostream> and Execuable Size

    Humm. OK every app I've ever coded using <iostream> and mainly cout is always between 40kb and 80kb max. How can it grow to over 400kb?

    Say you have, I dunno, 5 primary functions you use out of <iostream> throughout your app. Doesn't your program use the same code (say a pointer) to refer back to those same functions, even though you may reference those functions multiple times? Or if you have a LOT of code I could see the app getting big.

    I don't see how simply using a few functions from <iostream> can bloat it that badly unless you're configured for Debug.

    I love having gurus to explain this stuff.

  12. #12
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: <iostream> and Execuable Size

    I think it might be Debug ...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    Re: <iostream> and Execuable Size

    Yeah, it is debug.

    But I've noticed something else now, when I compile a certain project under VC++ under debug, its about 200kb, when I compile it under release, it's about 100kb. But when I compile it with Dev-C++ it's about 14kb, and then when I compile it with the VS Command Prompt it's 4kb. Why are they all different sizes when they all function the same way?

  14. #14
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: <iostream> and Execuable Size

    Your project settings might by default be different than the settings at the command line. Also, Dev-C++ uses a completely different compiler.

    In the project settings, there should be a place where you can find the complete command line for compiler and linker. Use these, and see if the binary is the same size. Then you can try optimizing it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    28

    Re: <iostream> and Execuable Size

    Yeah, I checked, its using heaps of options, and I'm just using one or two. All those options are making the file size a lot larger.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width