This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C not stongly typed enough?

Hello all,
I have been following the recent clashes between various participants (see the post "Compiling differences between C51 v7.03 and v8.06" or "introducing the smoked sardine complex" :) :) ).
C was given, I think, a unjustified bash in that post. I wouldn't like to have been compelled to explicitly cast too often. Most potentially dangerous casts can be filtered out by a static code analyzer. Can you give an example of more strongly-typed languages than C that are used in embedded development?

Parents Reply Children
  • Andy, all,
    I am a staunch believer that almost any programming language (except Cobol, maybe :) ), bestowed in the hands of a capable person, can get almost any job done!
    I don't have a problem with anybody bashing C, but other programming languages deserve a similar treatment (C++, for example, is much more dangerous to work with. classical example: transferring a pointer to a base class as a parameter to a function and treating it as an array! this is not defined). I thought that you were trying to say that certain problems can be solved better given a more strongly-typed tool. It's all a question of trade-off and capable hands, I think.
    Cactus Blip

  • Newer versions of C++ do have RTTI and more advanced cast operations to help a user that cares.

    People who do not apply engineering will most probably fail with whatever tool they lay their hands on.

    You can use FEM to simulate the stress on a mechanical structure. If the builder then decides to switch material, the FEM simulation will not help.

  • Still not clear exactly what you think was the "bash" against 'C'?

    "I thought that you were trying to say that certain problems can be solved better given a more strongly-typed tool"

    No, I don't think I would've said that!

    I don't think it helps to solve the problem, but it can help to catch (potential) errors in the solution.

    Whether there's a net benefit is, of course, the big question...

  • "I am a staunch believer that almost any programming language (except Cobol, maybe :) ), bestowed in the hands of a capable person, can get almost any job done!"

    There's a well-known saying that a Real Programmer can write FORTRAN in any language...

    ;-)

  • There are groups of flat earth people on the 'Left' coast of the US that believe that Forth with objects is the only embedded typed language. If you don't like a data type just re-define it at run time ;-).

  • I had it with you! I'm going back to basics! That is, BASIC ;-)