Re: OT:C/C++ Opinion Poll
- From: "FD" <fd@xxxxxxxxxx>
- Date: Fri, 30 Nov 2007 11:02:45 +0100
"The Real Andy" <therealandy@xxxxxxxxxx> schreef in bericht
news:rggvk355kc09brfc8v1hn7geu1oi9cdi5j@xxxxxxxxxx
On Thu, 29 Nov 2007 14:00:06 +0100, "FD" <fd@xxxxxxxxxx> wrote:
"The Real Andy" <therealandy@xxxxxxxxxx> schreef in bericht
news:rd7tk3h38lhh5vhh42ct30im066ps7tav2@xxxxxxxxxx
On Thu, 29 Nov 2007 01:59:56 +0100, "FD" <fd@xxxxxxxxxx> wrote:
<snip>
There is no "better" programming language.
Just know what you are doing (and why)!!
Agreed. Spot on.
Frank
PS.
To stir up the discussion: C requires that you know what you are doing!
So does c++, epsecially so if you are doing embedded stuff.
I have seem some really good embedded c++, and I have seen some really
bad c, likewise asm. I have my opinions where c should cross over to
c++, but its exactly that, and opinion.
I seldom have seen "good C++", meaning: I could reuse someone elses
objects
blindly.
Most C++ programmers nowadays have not done the "real thing" before
(assembly and C) and therefore lack practical knowledge of structured
programming.
I believe this is a requirement for embedded programming, where there are
a
lot of globals around (variables, registers, IO ports) and asynchonous
code
(interrupts, threads) that need to run 24/7.
BTW, i need to do some maintenace on an embedded device in the very
near future. The firmware is in c++. In this circumstance it was a
poor choice, and was simpy used because a few engineers wanted to try
their hand at c++. It should have been written in C, but it wasn't. I
see a lot of this, and perhaps this is where c++ gets a bad name with
firmware engineers.
For me personally C++ has a bad name because of exceptions and garbage
collection. Lots of people love this, I hate it.
These features allow programmers to focus more on the coding itself and
less
on the proper handling of unforeseen situations and object usage.
Unfortunately in embedded programming there are no "unforeseen
situations",
there must always be a solution (remember: 24/7 code). Objects should be
destructed by the programmer to release locks on globals (avoiding
deadlocks) and stay in control of memory usage (which is often limited).
Frank
Well c++ itself does not have garbage collection. You do get full
control of memory management, but like C, one can allocate memory and
not release it. The mistake can be made in both. Now when you say
'often limited', the usually indicates one of my preferences for using
c as opposed to c++, but once again, this is my opinion.
As for 24/7 code, I have plenty of c++ code with uptime of years. Its
how you code, not what you use.
Right. That was my very first arguments.
Frank
.
- References:
- OT:C/C++ Opinion Poll
- From: Ed
- Re: OT:C/C++ Opinion Poll
- From: Tim Wescott
- Re: OT:C/C++ Opinion Poll
- From: Jim Relsh
- Re: OT:C/C++ Opinion Poll
- From: FD
- Re: OT:C/C++ Opinion Poll
- From: The Real Andy
- Re: OT:C/C++ Opinion Poll
- From: FD
- Re: OT:C/C++ Opinion Poll
- From: The Real Andy
- OT:C/C++ Opinion Poll
- Prev by Date: Why does portmap daemon run when i start multiice server?
- Next by Date: Re: TCP/ IP, USB stacks and ThreadX
- Previous by thread: Re: OT:C/C++ Opinion Poll
- Next by thread: Re: OT:C/C++ Opinion Poll
- Index(es):
Relevant Pages
|