Author |
Message |
Frederick #1 / 8
|
 Why are stream so big?
Hi, I've never seen source code of Standard C++ Library other than that coming with VC++, but I wonder, why programs that use stream are always so BIG? And is it normal that some functions of Standard C++ library (in VC++) sometimes simply call its C equivalent? Using printf() generates small code, but write cout << once, and your program blows. There are some people that actually write smaller C++ programs than the C equivalents, so I think the reason behind this might be the implementation. What do you think? Any of you ever try to compare both language on other platforms? Thanks. -- Frederick J. Dunhill To reply via e-mail, replace coldmail.org with hotmail.com "How about an anti spammers campaign?"
|
Sun, 15 Apr 2001 03:00:00 GMT |
|
 |
P.J. Plauge #2 / 8
|
 Why are stream so big?
Quote:
> I've never seen source code of Standard C++ Library other than that >coming with VC++, but I wonder, why programs that use stream are always so >BIG? And is it normal that some functions of Standard C++ library (in VC++) >sometimes simply call its C equivalent? Using printf() generates small code, >but write cout << once, and your program blows. There are some people that >actually write smaller C++ programs than the C equivalents, so I think the >reason behind this might be the implementation. What do you think? Any of >you ever try to compare both language on other platforms?
Yes, we at Dinkumware are continually comparing our products with those of our competitors. For comparable functionality, we always come in much smaller -- and we intend to keep it that way. The big hit that comes with Standard C++ is all that facet machinery, which is really hard to optimize away completely. We keep making it better, but there's a long way to go before we get back to the sizes characteristic of the traditional iostreams library. (That's why we made the Dinkum EC++ Library and the Dinkum Abridged Library for embedded applications.) P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.com/hot_news.html
|
Sun, 15 Apr 2001 03:00:00 GMT |
|
 |
Thiruvalluvan. M. #3 / 8
|
 Why are stream so big?
Normally cout << version should be smaller. Any decent implementation such as Borland for MS-DOS or Windows, GNU C++ etc. indeed produce smaller code for cout << compared to printf. This is because, cout << functions are designed to handle a single data type such as char *, long, float etc. On the other hand printf has been designed to handle all datatypes (%d, %s, %c etc.) and printf does not know what is in the format string going to have until the runtime. So you get all functionality with printf whether you need it or not, which makes printf version fatter. But who said Microsoft C++ products are decent?
Quote: > Hi, > I've never seen source code of Standard C++ Library other than that > coming with VC++, but I wonder, why programs that use stream are always so > BIG? And is it normal that some functions of Standard C++ library (in VC++) > sometimes simply call its C equivalent? Using printf() generates small code, > but write cout << once, and your program blows. There are some people that > actually write smaller C++ programs than the C equivalents, so I think the > reason behind this might be the implementation. What do you think? Any of > you ever try to compare both language on other platforms? > Thanks. > -- > Frederick J. Dunhill > To reply via e-mail, replace coldmail.org with hotmail.com > "How about an anti spammers campaign?"
|
Sun, 15 Apr 2001 03:00:00 GMT |
|
 |
Thiruvalluvan. M. #4 / 8
|
 Why are stream so big?
An afterthought. Try Silicon Graphics STL instead of Microsoft's. Good luck.
Quote: > Hi, > I've never seen source code of Standard C++ Library other than that > coming with VC++, but I wonder, why programs that use stream are always so > BIG? And is it normal that some functions of Standard C++ library (in VC++) > sometimes simply call its C equivalent? Using printf() generates small code, > but write cout << once, and your program blows. There are some people that > actually write smaller C++ programs than the C equivalents, so I think the > reason behind this might be the implementation. What do you think? Any of > you ever try to compare both language on other platforms? > Thanks. > -- > Frederick J. Dunhill > To reply via e-mail, replace coldmail.org with hotmail.com > "How about an anti spammers campaign?"
|
Sun, 15 Apr 2001 03:00:00 GMT |
|
 |
Frederick #5 / 8
|
 Why are stream so big?
Quote: >Yes, we at Dinkumware are continually comparing our products with those >of our competitors. For comparable functionality, we always come in much >smaller
Well, at least I'm convinced now that the one I use is still relatively smaller (or smallest?) than the others :-) But one question: Do you think rewriting Standard C++ library so that it is completely independent of Standard C Library will make it smaller? And is it possible? I think writing Standard C++ Library by using native API inside will yield smaller code. Of course, it won't be so portable then. But that was also a problem with C Library, right? Thanks. -- Frederick J. Dunhill To reply via e-mail, replace coldmail.org with hotmail.com "How about an anti spammers campaign?"
|
Mon, 16 Apr 2001 03:00:00 GMT |
|
 |
Frederick #6 / 8
|
 Why are stream so big?
Quote: >Try Silicon Graphics STL instead of Microsoft's.
So there's nothing we can do about the streams then? And about SGI STL, I have tried it once with VC++ 5.0, and it choked the compiler to death. Have you tried it with VC++ 6.0? What need to be changed, if any? Thanks. -- Frederick J. Dunhill To reply via e-mail, replace coldmail.org with hotmail.com "How about an anti spammers campaign?"
|
Mon, 16 Apr 2001 03:00:00 GMT |
|
 |
James Curra #7 / 8
|
 Why are stream so big?
Quote: >An afterthought. >Try Silicon Graphics STL instead of Microsoft's.
Not much point, on this matter, as it doesn't include streams. -- Truth, James [MVP] http://www.NJTheater.Com -and- http://www.NJTheater.Com/JamesCurran begin 666 James M. Curran.vcf
M4DLZ.SLQ."!*;VAN(%-T+"!3=6ET92 R0CM";&]O;69I96QD.TY*.S W,# S M+34Q-#D-"DQ!0D5,.U=/4DL[14Y#3T1)3D<]455/5$5$+5!224Y404),13HQ M."!*;VAN(%-T+"!3=6ET92 R0CTP1#TP04)L;V]M9FEE;&0L($Y*(# W,# S M+34Q-#D-"E523#IH='1P.B\O=W=W+DY*5&AE871E<BYC;VTO2F%M97-#=7)R M86X-"E523#IH='1P.B\O=W=W+DY*5&AE871E<BYC;VT-"D5-04E,.U!2148[ M24Y415).150Z2F%M97-#=7)R86Y 0V]M<'5397)V92YC;VT-"E)%5CHQ.3DX
` end
|
Mon, 16 Apr 2001 03:00:00 GMT |
|
 |
P.J. Plauge #8 / 8
|
 Why are stream so big?
Quote:
>>Yes, we at Dinkumware are continually comparing our products with those >>of our competitors. For comparable functionality, we always come in much >>smaller >Well, at least I'm convinced now that the one I use is still relatively >smaller (or smallest?) than the others :-) But one question: Do you think >rewriting Standard C++ library so that it is completely independent of >Standard C Library will make it smaller?
If you're talking specifically about avoiding the use of printf, then yes, you can probably save some space by writing inserters that don't use printf. But that is by no means the major contribution to the code bloat that comes with using the Standard C++ library. If you're talking about eliminating completely the use of the Standard C library from within the C++ library, that is an exercise that is both silly and useless. The former is required anyway, and it handles all sorts of problems quite nicely. Not much point in reinventing that particular wheel. Quote: > And is it
possible? I think writing Quote: >Standard C++ Library by using native API inside will yield smaller code. Of >course, it won't be so portable then. But that was also a problem with C >Library, right?
But the Standard C library solves many portability problems for you. Why not use it? P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.com/hot_news.html
|
Mon, 16 Apr 2001 03:00:00 GMT |
|
|
|