home *** CD-ROM | disk | FTP | other *** search
- Path: news.genie.net!usenet
- From: i.einman@genie.com (IAN J. EINMAN)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: C vs. C++ -> SAS/C binary size
- Date: 17 Feb 1996 22:40:04 GMT
- Organization: via GEnie Services (1-800-638-9636 or info@genie.com)
- Sender: i.einman@genie.com (IAN J. EINMAN)
- Message-ID: <4g5lg4$6jv@rock101.genie.net>
- NNTP-Posting-Host: rock102.is.ge.com
-
- >>Why such a big difference in size of executables?
-
- The comparison you gave was basically the worst case. The printf function is
- very small compared to the iostream class. But it is unfair to say that
- "C++ is much larger than C" because the printf function is useable in C++.
-
- In general, classes can be larger than the old C functions, but they are far
- more powerful. When you used the "cout" function, and dumped text to the screen,
- you also included all i/o functions: formatting, input/output, file input/output,
- and all sorts of stuff, that all comes in one package called the "iostream class".
- If you started to call more C functions in the first one, like scanf, fscanf, fprintf,
- and a bunch of string functions that you would need to have some of the same formatting
- poer the iostream has, the C program would grow much larger, but the C++ program would
- have most of this stuff there already.
-
- The program you wrote is a useless program. If it was much larger, with many uses of
- the power of C++ where it could make some tasks easier, it would be a fair comparison.
- And last of all, there is nothing in the world that stops you from using "printf"
- in C++ if it is all that you need to use in your program.
-
- You really need to test a major program designed under C and under C++ to make the
- comparison, the size of including "printf" vs. the complexity of the iostream class
- is not a fair comparision. The iostream can do things printf could never dream of in
- that 6000 byte program it can compile to.
-
-