Results 1 to 8 of 8

Thread: Two questions

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Two questions

    1. If I have these headers:
    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    using namespace std;
    #inclue <stdlib.h>
    will this make my .exe file huge? I included these and compiled it in release mode optimized for size and it is 152 kb or some such.

    2. Is there a way to input a string in C (not C++) with spaces in it?
    Alcohol & calculus don't mix.
    Never drink & derive.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    1. Including the string template brings a large proportion of the iostreams code in as well. I don't think stdlib.h has much effect though. Set your linker options to emit a map file and then look at that in WordPad.

    2. scanf?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    What am I looking for? The mapfile is 247 kb.
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Zip & Attach it and I'll give you a mini-analysis
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Btw, scanf doesn't work, but gets does.
    Attached Files Attached Files
    Alcohol & calculus don't mix.
    Never drink & derive.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    OK. It's included all the locale-handling code which basically brought the ENTIRE IOStream library in. It's all referenced in the mapfile (mangled names )
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    I rewrote it using C functions and the release-mode optimized-for-size .exe turned out to be 36 kb. Why are C++ .exe's so much bigger than ones in C?
    Alcohol & calculus don't mix.
    Never drink & derive.

  8. #8
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    C++ has a lot more overhead with certain things. For example, IOStreams is a whole library, whereas C just has struct FILE pointers, and raw file handles.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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