Re: OT:C/C++ Opinion Poll



"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


.



Relevant Pages

  • Re: Recommended Text For Embedded C/C++
    ... slightly naive Vladimir insofar as embedded programming is specific to the ... "Programming Embedded Systems I", that looks very helpful. ... point of view and completed DSP projects in MATLAB and some small projects ... as that usually takes up less memory. ...
    (comp.dsp)
  • Re: Requesting advice how to clean up C code for validating string represents integer
    ... technical definition of a programming language) which in ordinary ... usage has a "wide variety of exact meanings in many walks of life", ... whether some random set of memory cells in a C core image, ... north-west relative to the rest of the Bay Area. ...
    (comp.lang.c)
  • Re: MAKEINTRESOURCE in win32asm
    ... > practical use, as there is no reason, in Asm Programming ... (which would also require a second read from memory to complete), ... haven't noticed it...you must have had some address pointer, ... ooh, "messages"...the value zero can mean "window created", the value ...
    (alt.lang.asm)
  • Re: A case for HTML as a programming language
    ... > language that can express any finite state machine can express any ... amount of external read/write memory, ... By contrast, a full computer with only HTML as its language, no real ... programming language in addition, and links only to static WebPages (no ...
    (comp.programming)
  • Re: From the Donkeys mule. (Now I know why he looks funny too)
    ... Thats between you and Betov then, and as I know nothing there of, I ... I don't answer to you nor do I care about your opinion in any way. ... another example of bad programming. ... I never even notice the flicker. ...
    (alt.lang.asm)