[prog] Passing data between modules
Jimen Ching
jching at flex.com
Tue Jul 29 09:34:38 EST 2003
On Tue, 29 Jul 2003, Dan Richter wrote:
>There are also more practical reasons. In C you can't return a struct from
>a function, and you have to remember to initialize all your data
>structures. You can get around all the limitations of C (e.g., return a
Yes, one of the major advantages of C++ over C is that the object
methodology makes things easier. C++ can be used as a higher level
langauge than C, but you pay a price for this in performance.
Initialization of data structures are not _always_ required. One can
optimize that out and initialize the data structure with _real_ data.
With C++, the constructor _usually_ initializes the member variables with
_default_ data, only to be over-written with _real_ data later on. Of
course, the occurance of these _default_ initialization can be reduced,
but they can't be eliminated 100% of the time.
It seems Conor's application is very performance sensitive. So the
question of going with C++ needs careful consideration.
Note: Conor, I'm sure you'll be able to find both C and C++ compilers for
most Unix-like OS's into the far future. So I don't think you need to
worry about language longevity when it comes to C and C++. Of course, if
you have the source code to the compiler, you don't need to worry about it
disappearing. Another advantage of Free Software. ;-)
--jc
--
Jimen Ching (WH6BRR) jching at flex.com wh6brr at uhm.ampr.org
More information about the Programming
mailing list