Size of exe files

This is a discussion on Size of exe files within the C++ Programming forums, part of the General Programming Boards category; I know that using C++ compilers adds some space to the size of a file. I am just wondering if ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    241

    Size of exe files

    I know that using C++ compilers adds some space to the size of a file. I am just wondering if the amount of variables declared in the program increases the file size. I didn't think it did, but I have a failry siple program that is 4 MB.

  2. #2
    Ted
    Ted is offline
    Registered User
    Join Date
    Aug 2001
    Posts
    52
    The file size is based on your compiler's ability to optimize the code and your ability to write the code.

    You need to read your compiler's docs to know its optimization capabilities.

    The number of vars does not significantly increase the file size. Your choice of logic structures, e.g., if else, switch, while, for, etc., does.

    hth,

  3. #3
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    If you're using MSVC try setting it to release setting rather than the default debug. That cuts the file size down dramatically. Then you can specify the optimizations too.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    I used Borland C++ 5.02 to compile it. I am not sure of the exact code because I modified it a few times, and I haven't looked at it in a while.

  5. #5
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Your variable names add nothing to the end file size. When compiled, all variables 'lose' their name.. therefore naming something 'i' instead of 'myVariableThatHoldsAValueForMyLoop' makes no difference.

    But as someone else stated (did they?) that the amount of variables will.

  6. #6
    Unregistered
    Guest
    For a large program, variable names might start getting important, but for "very simple" programs, it is usually what you link that determines the size. Try optimising your #includes and your libs.

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    241
    well this program calculates the first 10,000,000 prime numbers, and I am not sure how my variables are set up

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Generic heapsort
    By Sephiroth1109 in forum C Programming
    Replies: 15
    Last Post: 12-07-2007, 06:14 PM
  2. Error with a vector
    By Tropicalia in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2006, 08:45 PM
  3. exe files in -c- language
    By enjoy in forum C Programming
    Replies: 6
    Last Post: 05-18-2004, 05:36 PM
  4. Replies: 11
    Last Post: 03-25-2003, 05:13 PM
  5. Create exe files
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 09-16-2001, 09:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21