C or C++?

Steven W. Orr steveo at syslang.net
Fri May 27 12:09:01 EDT 2005


On Friday, May 27th 2005 at 11:48 -0400, quoth Jim Kuzdrall:

=>Greetings All,
=>
=>    A military client arbitrarily added 2 contract requirements which I 
=>have the opportunity to change.  I need some advice from your 
=>collective experience to make certain I don't regret my choice a year 
=>from now.
=>
=>    The stipulations were: 1) use Linux; 2) use C++.
=>
=>    The system is an embedded 32-bit DSP-type microcontroller (of my 
=>choice) with about 1 megabyte of code.  It is battery operated and uses 
=>prioritized, real-time interrupts to meet response time criteria.  The 
=>software functions are "modular" and well defined.
=>
=>    -no operator/user will input data to the processor; all inputs come 
=>from hardware.
=>    -the range of inputs is known (i.e. 256, 4096, 65536) so exhaustive 
=>testing is feasible. 
=>    -the software will rarely be revised; any change requires field 
=>testing for re-qualification which costs about $1.5M.
=>    -no Ethernet or networking (except via a radio network which is 
=>separate layer beyond this).
=>    -no disks or file storage facility.
=>    -one serial port for diagnostics and up-loading the flash memory.
=>    -few if any Standard Library functions are needed.
=>
=>    It is nice to see their heart in in the right place with Linux, but 
=>I see no reason for any operating system, so I am comfortable with 
=>eliminating that.
=>
=>    C++ versus C is my quandary.  Can anyone give me good reasons for 
=>choosing one over the other in this case.  Opinions are welcome, but I 
=>must have a list of reasons ready if my choice is questioned.

The way I see it, it's just an efficiency issue. C++ is going to give you 
the same size code unless you use the object features. For example, new is 
always a heap allocation. In C you can more easily decide that a 
particular instance of something could be stack based.


-- 
steveo at syslang dot net TMMP1 http://frambors.syslang.net/
Do you have neighbors who are not frambors?



More information about the gnhlug-discuss mailing list