:: Re: [DNG] C vs ADA : advice sought
Etusivu
Poista viesti
Vastaa
Lähettäjä: Didier Kryn
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [DNG] C vs ADA : advice sought
Le 01/10/2024 à 18:13, Dan Purgert via Dng a écrit :
> On Sep 30, 2024, o1bigtenor via Dng wrote:
>> Greetings
>>
>> if I were to want to choose between learning C (and likely adding C++) and
>> learning ADA for programming microcontrollers and embedded systems
>> what - - - besides amount of usage would you use to advise me - - -
>> which should I learn (and why please (this is at least as important as
>> your choice!!!))?
> At the end of the day, you need to be able to read and understand the
> Minimum Working Example ("MWE") code in the datasheets. And, well,
> that's going to be C.
>
> If you don't know enough programming in general to parse that MWE code,
> you're going to have a real hard time rewriting that into the
> "better(tm)" language.
>
> Once you can read the MWE in the datasheet, well, then by all means go
> off to something else if you want to.
>

    Fully agree. You will always need to know some C, even if you
program in Ada. The kernel interface is generally mediated by a C
library. Ada features a set of interfaces to other languages such as C,
C++ and Fortran, which allow easy Ada bindings to some system-calls
which you would need to invoke, such as IOCTL. Therefore, unless you are
programming for bare metal, you will always need some familiarity with C.

    However I warn you that C++ is not an easy transition from C. This
idea seems natural but it is an illusion. First the two languages have
diverged, meaning that C instructions compiled by the C++ compiler may
produce different results, and vice-versa for C++ instructions which
look like C. Second, C++ has a very steep learning curve and is a very
difficult language. Third it keeps, by design, all the pitfalls of C.
C++ was developped to implement in C all the OO features first
experimented in Ada, partly because there was not yet a reliable Ada
compiler. But I consider it was a bad idea from the beginning. I
attended a one week lecture on C++ in the 90's; I was enthusiastic the
first day, but got quickly the feeling it was a degradation of C.

    I know my words will shock the C++ afficionados. I admire very much
C++ programmers: they do a very difficult job. But I don't see any good
reason to do like them. It is possible to do a better job, simply by
using an easier, safer, and more expressive language.

--     Didier