Just Curious!?!

This is a discussion on Just Curious!?! within the C Programming forums, part of the General Programming Boards category; I wrote a small game in C and when I was done I decided to write it in C++ just ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    14

    Question Just Curious!?!

    I wrote a small game in C and when I was done I decided to write it in C++ just for fun to see if there were any differences between writing in either language, when I was done they were both the same length in lines both used the same 3 #include files, but the weird thing was that the C++ exe file was bigger than the C exe file, anyone know why this would happen? And if it's common wouldn't it be wiser in the long run just to code in C?

    James

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    C++ always bloats the resulting executable. It's just like VB bloats its executables, or delphi bloats its, or even C bloats its. The higher level the language the more bloated the file will be (generally)

    The reason people use C++ over C is that it's easier to do certain things, and it's OOP. I like C best IMHO, but I do see the advantages of C++, and plan to learn it sooner or later.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    14
    I found out why this was so shortly after I made the post, C is 16 bit and C++ is 32 bit.

    James

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    It doesn't really have so much to do with umm 'bit-ness'. It just has to do with how muchstandard library-ish stuff gets included in your program.

    Also, debugging information is an issue. If you're really worried about code size, you need to turn off debugging when you compile.

    The extra size if generally a one-time thing. Like, any program you write will have an extra say, 400kb tacked on to it, but as your program itself gets bigger, the effect will be less noticable. (Except for debugging information, which will get bigger as your program gets bigger).
    Callou collei we'll code the way
    Of prime numbers and pings!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Curious GCC error messages
    By Mario F. in forum Tech Board
    Replies: 1
    Last Post: 11-22-2006, 03:57 PM
  2. Just curious
    By Chaplin27 in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2004, 10:57 AM
  3. Curious about thumdnails
    By Gravedigga in forum Windows Programming
    Replies: 1
    Last Post: 03-08-2004, 09:02 AM
  4. A curious question
    By sbongo in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 01-02-2004, 08:55 PM
  5. Curious About Master Boot Record
    By civix in forum Tech Board
    Replies: 1
    Last Post: 01-26-2003, 01:19 AM

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