Thread: Impossible

  1. #1
    Mmm. Purple.
    Join Date
    May 2002
    Posts
    154

    Impossible

    I bet none of ya can make a c++ prog less than 10kb

  2. #2
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    Can you?

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    170
    i just compiled

    int main(){}

    and it was 656098

    using g++.
    Best Regards,

    Bonkey

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    i don't have access to my compiler right now but i think

    int main()
    {
    return 0;
    }

    might do it

  5. #5
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    int main()
    {
    return 0;
    }
    Nope. Tried that and alot of other things. All gave me the same size : 56.0 KB / 51.0 Kb

    Ok hotshot, show us if you can do it!!

  6. #6
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    hmm

    void main()
    {
    }

  7. #7
    Bios Raider biosninja's Avatar
    Join Date
    Jul 2002
    Location
    South Africa
    Posts
    765
    void main()
    {
    }
    mmmm....

    NOPE tried that as well!!

  8. #8
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    C++ is a high level language so its not possible.

  9. #9
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    DAMMIT!

    hmmmmmmm


    no clue dude

  10. #10
    Smallest is 24.0KB with VC++

    void main(){} or int main(){}

    doesn't matter which.
    My Avatar says: "Stay in School"

    Rocco is the Boy!
    "SHUT YOUR LIPS..."

  11. #11
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Code:
    int main () {
    
    return 0;
    }
    gave me 13k here...

  12. #12
    Evil Member
    Join Date
    Jan 2002
    Posts
    638

    GOT IT!!!!

    I made a program in C++ that was 955 bytes long.

    All it does is cause a segmentation fault, but it compiles and executes!

  13. #13
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    >Smallest is 24.0KB with VC++

    This'd do it on MSVC++ -

    Code:
    #define main mainCRTStartup
    
    int main()
    {
    	return 0;
    }
    With the linker options -

    /NODEFAULTLIB /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /MACHINE:IX86

    Comes in at exactly 1 KB. You may be able to get it lower than that by tinkering with the options a little more. It's not really a valid C++ program but I'd guess most compilers have the option of turning off the default runtime.

    Removing the /NODEFAULTLIB in MSVC and compiling with the standard main produces a 3.5KB exe.
    Joe

  14. #14
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    But does it execute?

  15. #15
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    >But does it execute?

    Yes, but you'd have problems unless you want to code some of the start up runtime yourself.
    Joe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Nested Loop with add-on Equation..?? Seems Impossible!
    By AssistMe in forum C Programming
    Replies: 3
    Last Post: 03-11-2005, 12:28 PM
  2. (Im)possible Algorithm
    By Cikotic in forum C Programming
    Replies: 28
    Last Post: 03-31-2004, 08:36 AM
  3. 0% probability == impossible?
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 49
    Last Post: 09-01-2003, 03:48 PM
  4. Deleting classes, or is it impossible?
    By Lariumentiko in forum C++ Programming
    Replies: 13
    Last Post: 02-02-2003, 04:26 PM
  5. The Impossible "Surf'n'Compile" Lifestyle
    By Sebastiani in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-01-2001, 11:45 AM