Thread: A few questions

  1. #1
    Unregistered
    Guest

    Question A few questions

    Hello,

    Ok. I have a few questions, so hopefully one of you will be able to answer some of them.

    1. Does MSVC++ and/or Windows have a limit of command line arguments (Cpp1.exe 1 2 3 4 5 6 7 .. .. ..). I made a program that worked with 6 arguments in windows and crashed on 7, but compiled the same source in bsd (g++) and it worked with 30 and/or more numbers. Just curious.

    2. By using #include <iostream> and manually (using std::cout;) save any filespace when compiling, or is there no advantage?

    3. In conjunction with #2, which is the best windows compiler for creating the smallest executable possible. I noticed that w/ MSVC++ everything is always 200k+ and with Dev-C++ 4, I can get the files down to 70k.

    4. In an MFC Appwizard application, is it not possible to create your own function
    i.e., void function(void);
    When I tried it, it said I was missing a function header and it said possibly old formal style, I have no clue what it ment.

    Thanks for any answers, I appreciate it.

    - Chris

  2. #2
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    I would think that argc and argv would be stored on the stack just as it is

    in linux and probably bsd too, I think. So the number of arguments would be determined
    by the amount of memory unless the operating system sets a limit.




    2. By using #include <iostream> and manually (using std::cout save any filespace when compiling, or is there no advantage?
    no filespace advantage that I can tell. By avoiding using the c library and the c++ library you can save alot of space, also you can get very small executables if you use dynamicaly linked c/c++ libraries however this is supposed to be slower.

  3. #3
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    to reduce the size of your executable make sure you compile for retail not debug. Windows puts in extra comments and stuff so it makes it easier to debug.
    I think this is true but I've never really had any experience with it though.
    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
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    sorry. here's what you can do.
    go
    build -> Set Active Configuration
    switch it to release.
    then go to
    project -> settings -> C/C++
    then either set the category to general or optimizations
    then set the optimizations menu to mininum size.
    that reduced a 201kb Direct3d program to a 36kb one.

  5. #5
    Unregistered
    Guest
    Thanks.

    I think Windows 2000 must have some limit, but I cant find an answer anywhere.

    Also,

    Those tips for small file sizes are for mfc apps and such, I couldn't seem to get those options enabled for a simple console application.

    Thanks,

    Chris

  6. #6
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    I don't do much console stuff anymore but I recently helped a friend with her program and I compiled it both ways and it worked just fine.

    original console size: 209kb
    after min size setting: 52kb

    the new executable will be in a Release folder in your project not the Debug folder as usual.

  7. #7
    Unregistered
    Guest
    Like I said,

    Those options aren't even enabled when compiling a console program or ansi c.

  8. #8
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    If you're not too sensitive about your code, post an attachment here and I'll compile it and see what I can do. I didn't have any problems setting the configurations in console, win32 apps or mfc apps so I'm not quite sure what you're doing that's not working. We are talking about VC++ right?

    I created a new console project (the hello world that windows will make for you) and got these results:
    153kb default debug settings
    28kb release settings optimized for minimum size

    make sure you set the active config to release or it won't compile correctly for minumum size.

  9. #9
    Unregistered
    Guest
    All I am doing is opening a blank .cpp file, and trying to set the options w/ that. I don't use any of the microsoft generated stuff.

  10. #10
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    first create a blank application then add your source code to the project and all the options should be available to you.
    Sounds like you're neglecting to create a project space for it.

  11. #11
    Unregistered
    Guest
    It worked, Thanks.

    I didn't know console applications could have workspaces, my teacher neglected to show us. Thanks for the help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 08:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 07:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 07:22 AM