|
From: Per W. <pw...@ia...> - 2003-04-23 22:05:53
|
We had a long discussion about memory layout and problem porting Fortran routines efficiently to C++ some moths ago :-) Well, language comparisons will always pop up in the list more or less regularly. One thing about size of binaries. For a small binary, even a little extra results in a large proportional difference. Some few reasons why C++ applications gets larger: - Mangled names results in larger debug information. - More complex data structures in the header files results in larger debug info. - Most OS have C-like API, so a lot of low-level C++ classes must in the end call C function, while the C app sometimes could call the C function directly. - C++ compiled with RTTI adds a lot of extra book-keeping in the binary. - Support for some combinations of multiple-inherritance results in a lot of extra code to type-cast between super- and sub-classes. - Exception support, to correctly find all auto-declared objects to destruct on the stack. - Template code that results in code expansion, where the application gets several versions of similar code. Yes, there are a number of reasons why a C++ application might be smaller too, such as good use of virtual methods to better reuse code in abstract base classes etc... However, the most common reason for larger C++ binaries is that libc++ adds in a lot of extra goodies that quickly bloats small programs, but makes large applications grow slower because of code reuse. /Per W On Wed, 23 Apr 2003, Samuel Keding wrote: > Hey, > > A language doesn't equal religion. For those of you who can only read C or C++ > > bool isEqual = (language == religion) > > cout or printf isEqual > > On the console appears 0. > > It doesn't really matter a lot. C can be more effiecent at times, and ease is a matter of opinion. Some problems are easier to understand in the object oriented sense. In that case, C++ will probably be easier. In any case a langauge is a tool. If your welding you might want a welding torch. However, you probably do not want to use a welding torch when drying the clothes. You probably want to use a dryer for that. C, C++, Java, Fortran, use them where it proves useful. Oh, one other thing, Fortran is evil. Do not use it. > > :D > > > ____________________________________________________________ > Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail! > http://login.mail.lycos.com/r/referral?aid=27005 > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |