DSPRelated.com
Forums

Quickie Poll -- C vs. C++

Started by Tim Wescott August 25, 2010
So, I'm working on a spare-time project that's off the back burner for 
at least a day.  It's a trainer, and I'd _like_ to be able to set it up 
so that advanced students can do their own programming.  Hence, the poll.

So, since anyone who responds to a dippy poll on USENET is obviously 
100% representative of the embedded software engineering public, I know 
that your responses will accurately reflect reality.

If you answer this poll you will _not_ be entered into a contest to win 
an iPod, or a free smokeless cigarette, or anything else.  So do it for 
the glory, and to advance the state of the species.

Please don't fire up the C vs. C++ flame war -- we all know that Forth 
is the best language in the world next to Python, so C vs. C++ is really 
moot anyway.

What is your _preferred_ programming language for smallish (1000 lines 
of code) projects?  C?  C++?  Something else?  What?

Why?

Would you describe yourself as being competent in both C and C++?  If 
only one, which?

What size processor(s) do you most often find yourself using?  8 bit? 
16?  32?

What size of memory space do you most often find yourself using?  Less 
than 1kbyte?  1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?

If you had to use someone's library code in your smallish project and 
knew nothing about it other than the language it's written in, would you 
be happier knowing it was in C, C++ or some other language?

Are you comfortable reading schematics of digital circuits?

Are you comfortable reading schematics of mixed analog and digital circuits?

If you can't read schematics, can you find your way around a block 
diagram?  Can you understand explanations of circuit behavior given by a 
sympathetic hardware engineer?

Thanks.

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html
On Aug 26, 9:35&#4294967295;am, Tim Wescott <t...@seemywebsite.com> wrote:
> So, I'm working on a spare-time project that's off the back burner for > at least a day. &#4294967295;It's a trainer, and I'd _like_ to be able to set it up > so that advanced students can do their own programming. &#4294967295;Hence, the poll. > > So, since anyone who responds to a dippy poll on USENET is obviously > 100% representative of the embedded software engineering public, I know > that your responses will accurately reflect reality. > > If you answer this poll you will _not_ be entered into a contest to win > an iPod, or a free smokeless cigarette, or anything else. &#4294967295;So do it for > the glory, and to advance the state of the species. > > Please don't fire up the C vs. C++ flame war -- we all know that Forth > is the best language in the world next to Python, so C vs. C++ is really > moot anyway. > > What is your _preferred_ programming language for smallish (1000 lines > of code) projects? &#4294967295;C? &#4294967295;C++? &#4294967295;Something else? &#4294967295;What? >
Neither, I use LabView for simulation or Matlab. For embedded, c I suppose cos there is nothing better at present. Hardy
On 08/25/2010 11:35 PM, Tim Wescott wrote:

> What is your _preferred_ programming language for smallish (1000 lines > of code) projects? C? C++? Something else? What?
For project of such a small size I pick whatever let me finish the job faster, and that only depends on what language I've used for the previous task. (it always takes me two days to switch from C to C++..). At the moment I would pick C.
> Would you describe yourself as being competent in both C and C++? If > only one, which?
I play country and western.. (e.g. I'm fine with C and C++ and a bunch of others as well).
> What size processor(s) do you most often find yourself using? 8 bit? > 16? 32?
32 Bit. Mostly ARM cores. Worked with other and smaller cores as well, but in my field the 32 bitters have the best price/time to market ratio, so I rarely see anything else these days.
> What size of memory space do you most often find yourself using? Less > than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
Whatever the task requires plus some extra memory for convenience. If I do video decoding I obviously need a lot more than doing simple stream processing.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
The language does not make a difference for me as long as I know that it was written by experienced guys. If I don't know who has written the lib I prefer C. That makes it easier to debug things in case I have to step into the assembly code.
> Are you comfortable reading schematics of digital circuits?
Jep.
> Are you comfortable reading schematics of mixed analog and digital > circuits?
Jep.
> If you can't read schematics, can you find your way around a block > diagram? Can you understand explanations of circuit behavior given by a > sympathetic hardware engineer?
does not apply.. Cheers, Nils
In comp.dsp Tim Wescott <tim@seemywebsite.com> wrote:
 
> So, since anyone who responds to a dippy poll on USENET is obviously > 100% representative of the embedded software engineering public, I know > that your responses will accurately reflect reality.
(snip)
> What is your _preferred_ programming language for smallish (1000 lines > of code) projects? C? C++? Something else? What?
For less than about 10 lines it is awk, otherwise usually C. Between C++ and Java, I prefer Java.
> Why?
Because I am used to it by now? About 30 years ago I would have preferred PL/I, but it was too hard to find systems with a PL/I compiler and usually used Fortran. When I started learning about C, it seemed easier to use than Fortran for many problems.
> Would you describe yourself as being competent in both C and C++? If > only one, which?
I describe myself as being competent in both, but my C++ code looks a lot like C code. I can read C++ reasonably well, though.
> What size processor(s) do you most often find yourself using? > 8 bit? 16? 32?
Usually 32, but most often it doesn't matter that much.
> What size of memory space do you most often find yourself using? > Less than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
I don't try to write memory wasting code. If an algorithm can be implemented as a read/process/write loop in a small amount of memory, that seems the best choice to me.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
Most likely, C.
> Are you comfortable reading schematics of digital circuits?
Yes. I can also read them in verilog. Not so easily in VHDL, but maybe.
> Are you comfortable reading schematics of mixed analog and digital circuits?
Yes. I used to order the service manuals for home electronics that I bought, just in case I would need to work on them.
> If you can't read schematics, can you find your way around a block > diagram? Can you understand explanations of circuit behavior given by a > sympathetic hardware engineer?
-- glen
Tim Wescott wrote:

> What is your _preferred_ programming language for smallish (1000 lines > of code) projects? C? C++? Something else? What?
If its low level DSP or driver code C. For high level user space code, Haskell or Ocaml.
> Why?
C is good for low level code. For high level code I demand garbage collection, guaranteed safe string handling and strict static (ie compil time) type checking.
> Would you describe yourself as being competent in both C and C++? If > only one, which?
I'm highly compentant at C and reasonably compentant with C++. While I personally would never choose to use C++ I actually end up doing quite a lot in my day job. Fortunately, my usage of Haskell and Ocaml in my day job is growing. We basically have a rule for new code; if its low level code then use C and if its high level code, use Haskell or Ocaml.
> What size processor(s) do you most often find yourself using? 8 bit? > 16? 32?
32 and 64 bit.
> What size of memory space do you most often find yourself using? Less > than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
512k or more. Basically embedded Linux stuff.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
C. C code can be wrapped and accessed from high level langugages like Python, Ocaml and Haskell much more easily than C++ code.
> Are you comfortable reading schematics of digital circuits?
Very. Can even design digital circuits if you want me to.
> Are you comfortable reading schematics of mixed analog and digital circuits?
Yes. Can probably design as well, but is been a couple of years. Cheers, Erik (mainly responding to be an outlier). -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:e_edndXHmNJ_EejRnZ2dnUVZ_vydnZ2d@web-ster.com...
> > What is your _preferred_ programming language for smallish (1000 lines of > code) projects? C? C++? Something else? What? >
Oberon-07.
> Why? >
Excellent detection of errors before they lead to obscure secondary effects at runtime.
> Would you describe yourself as being competent in both C and C++? If only > one, which? >
C - 10 years experience.
> What size processor(s) do you most often find yourself using? 8 bit? 16? > 32? >
Only 32-bit.
> What size of memory space do you most often find yourself using? Less > than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte? >
8 to 64 kbyte.
> If you had to use someone's library code in your smallish project and knew > nothing about it other than the language it's written in, would you be > happier knowing it was in C, C++ or some other language? >
1. Oberon-07 2. C 3. Assembler
> Are you comfortable reading schematics of digital circuits? >
Yes.
> Are you comfortable reading schematics of mixed analog and digital > circuits? >
Yes. Regards, Chris Burrows CFB Software Astrobe: ARM Oberon-07 Development System http://www.astrobe.com
On Aug 25, 11:35&#4294967295;pm, Tim Wescott <t...@seemywebsite.com> wrote:
> So, I'm working on a spare-time project that's off the back burner for > at least a day. &#4294967295;It's a trainer, and I'd _like_ to be able to set it up > so that advanced students can do their own programming. &#4294967295;Hence, the poll. > > So, since anyone who responds to a dippy poll on USENET is obviously > 100% representative of the embedded software engineering public, I know > that your responses will accurately reflect reality.
Ah.
> If you answer this poll you will _not_ be entered into a contest to win > an iPod, or a free smokeless cigarette, or anything else. &#4294967295;So do it for > the glory, and to advance the state of the species.
Huh?
> Please don't fire up the C vs. C++ flame war -- we all know that Forth > is the best language in the world next to Python, so C vs. C++ is really > moot anyway.
Right...
> What is your _preferred_ programming language for smallish (1000 lines > of code) projects? &#4294967295;C? &#4294967295;C++? &#4294967295;Something else? &#4294967295;What? > > Why?
1) Matlab if I can - the leatherman tool of programming. Can do everything, if nothing particularly well. 2) C++. Once you get into it (which might take you decades, I know), it just *works*. Simple things are done in simple ways. 3) C. Because it avoids certain non-standardized technical issues with C++.
> Would you describe yourself as being competent in both C and C++? &#4294967295;If > only one, which?
C++, because I seldom find need for C these days.
> What size processor(s) do you most often find yourself using? &#4294967295;8 bit? > 16? &#4294967295;32?
32 bit, approaching 64 bit and multi-cores with caution.
> What size of memory space do you most often find yourself using? &#4294967295;Less > than 1kbyte? &#4294967295;1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
GBytes.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
I'd prefer it to be C, because then the pros and cons of interfacing would be known. Linking to a C++ library is difficult, since one needs to untangle name mangling issues. As I understand it, name mangling is the main reason why C++ libraries are issued on a per compiler / linker combo basis. With C you can issue libraries on a per HW/OS combo basis.
> Are you comfortable reading schematics of digital circuits?
Used to be. Now not so much.
> Are you comfortable reading schematics of mixed analog and digital circuits?
Used to be. Now not so much.
> If you can't read schematics, can you find your way around a block > diagram?
Can hardly find my way around the block...
>&#4294967295;Can you understand explanations of circuit behavior given by a > sympathetic hardware engineer?
Never had the oportunity to find out. Rune
On Wed, 25 Aug 2010 14:35:58 -0700, Tim Wescott wrote:

> So, I'm working on a spare-time project that's off the back burner for > at least a day. It's a trainer, and I'd _like_ to be able to set it up > so that advanced students can do their own programming. Hence, the > poll. > > So, since anyone who responds to a dippy poll on USENET is obviously > 100% representative of the embedded software engineering public, I know > that your responses will accurately reflect reality. > > If you answer this poll you will _not_ be entered into a contest to win > an iPod, or a free smokeless cigarette, or anything else. So do it for > the glory, and to advance the state of the species. > > Please don't fire up the C vs. C++ flame war -- we all know that Forth > is the best language in the world next to Python, so C vs. C++ is really > moot anyway. > > What is your _preferred_ programming language for smallish (1000 lines > of code) projects? C? C++? Something else? What?
Scheme (racket), Matlab, Python, C, in that order. Depends on what the project is trying to achieve, and in what context.
> Why?
Small projects are mostly quickie or exploratory projects, so garbage collection, high-level abstraction and safety are important levers to getting finished quickly. Racket and matlab can do (simple) GUI code portably, which is often helpful. If low-level is necessary, C is almost always the right answer.
> Would you describe yourself as being competent in both C and C++? If > only one, which?
Yes.
> What size processor(s) do you most often find yourself using? 8 bit? > 16? 32?
32 and 64, with side-orders of 16 and 24.
> What size of memory space do you most often find yourself using? Less > than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
Amusingly, the projects with the most source code tend to use the least runtime memory, in my experience. Back-of-the envelope scheme and matlab scripts use many megabytes. Multi-thousand line C programs might use a handful of K.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
C, Fortran or assembler. C++ is usually unusable from anything other than C++, for linkage and run-time support reasons. If the library is available in source, then that widens the possibilities significantly.
> Are you comfortable reading schematics of digital circuits?
Yes.
> Are you comfortable reading schematics of mixed analog and digital > circuits?
Yes.
> If you can't read schematics, can you find your way around a block > diagram? Can you understand explanations of circuit behavior given by a > sympathetic hardware engineer?
Probably. Cheers, -- Andrew
On 26.8.10 12:35 , Tim Wescott wrote:

> What is your _preferred_ programming language for smallish (1000 lines > of code) projects? C? C++? Something else? What? > > Why?
C with maybe some assembler, currently mostly gcc's asm statements.
> Would you describe yourself as being competent in both C and C++? If > only one, which?
Yes, and a bunch of other languages. I started in the 1960's with IBM 1620 SPS and Fortran II.
> What size processor(s) do you most often find yourself using? 8 bit? 16? > 32?
During the years, 8 to 64 bits. The current preferred order is 32 and 8 bits (ARM, AVR).
> What size of memory space do you most often find yourself using? Less > than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
Of your list, 8 to 64 kiB for small projects.
> If you had to use someone's library code in your smallish project and > knew nothing about it other than the language it's written in, would you > be happier knowing it was in C, C++ or some other language?
C, but I strongly would like to have sources, too.
> Are you comfortable reading schematics of digital circuits?
Yes.
> Are you comfortable reading schematics of mixed analog and digital > circuits?
Yes, even plain analog.
> If you can't read schematics, can you find your way around a block > diagram? Can you understand explanations of circuit behavior given by a > sympathetic hardware engineer?
In most small projects, I have been the hardware engineer, too. -- Tauno Voipio, MSEE (and OH2UG) tauno voipio (at) iki fi
>So, I'm working on a spare-time project that's off the back burner for >at least a day. It's a trainer, and I'd _like_ to be able to set it up >so that advanced students can do their own programming. Hence, the poll. > >So, since anyone who responds to a dippy poll on USENET is obviously >100% representative of the embedded software engineering public, I know >that your responses will accurately reflect reality. > >If you answer this poll you will _not_ be entered into a contest to win >an iPod, or a free smokeless cigarette, or anything else. So do it for >the glory, and to advance the state of the species. > >Please don't fire up the C vs. C++ flame war -- we all know that Forth >is the best language in the world next to Python, so C vs. C++ is really >moot anyway. > >What is your _preferred_ programming language for smallish (1000 lines >of code) projects? C? C++? Something else? What?
PC: Matlab, C, Python Mikrocontroller, DSP: Assembler, C, sometimes C++
>Why?
PC: depends to requirement - keep programming work as simple as possible Mikrocontroller, DSP: Is a C compliler available? -> No -> Assembler :)
>Would you describe yourself as being competent in both C and C++? If >only one, which?
Only rudimental knowledge of C++
>What size processor(s) do you most often find yourself using? 8 bit? >16? 32?
8 bit and 16 bit uC in fomer times 16 and 24 bit DSPs nowadays x86 architecture (also programmed in assembler)
>What size of memory space do you most often find yourself using? Less >than 1kbyte? 1 to 8kbyte? 8 to 64kbyte? More than 64kbyte?
1 to 8kByte
>If you had to use someone's library code in your smallish project and >knew nothing about it other than the language it's written in, would you >be happier knowing it was in C, C++ or some other language?
It should work :) and API should be described very well :)
>Are you comfortable reading schematics of digital circuits?
Yes
>Are you comfortable reading schematics of mixed analog and digital
circuits? Generally Yes
>If you can't read schematics, can you find your way around a block >diagram? Can you understand explanations of circuit behavior given by a >sympathetic hardware engineer?
Yes. Depends to HW engineer :)
>Thanks. > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com > >Do you need to implement control loops in software? >"Applied Control Theory for Embedded Systems" was written for you. >See details at http://www.wescottdesign.com/actfes/actfes.html >