:: [DNG] Ariane-5 explosion [was Study…
Top Pagina
Delete this message
Reply to this message
Auteur: Didier Kryn
Datum:  
Aan: dng
Oude Onderwerpen: Re: [DNG] Studying C as told. (For help)
Nieuwe Onderwerpen: Re: [DNG] Ariane-5 explosion
Onderwerp: [DNG] Ariane-5 explosion [was Studying C as told. (For help)]
Le 07/07/2016 23:57, Rainer Weikusat a écrit :
> Didier Kryn <kryn@???> writes:
>> Le 07/07/2016 19:25, Rainer Weikusat a écrit :
>>> The conversion happened implicitly as part of an assignment and the Ada
>>      There isn't implicit conversion in Ada.
> I vaguely imagine writing somewhat more than 'the Ada runtime threw an
> exception because it was asked to do a lossy assignment' (specifically,
> 'conversion' was you term and I just used it because you did).
> _______________________________________________

>


     There aren't lossy assignments either. It is forbidden to assign to 
a variable a value of a different type without an explicit conversion.


     Furthermore, with all due respect and humility, I am intrigued by 
the concept of a 16-bit integer in an Ada program. These words of the 
report indicate a lack of understanding of the language.  In Ada, a type 
is declared by its range, and its precision if it is floating or fixed 
point. You declare the data types you need so that their ranges match 
the quantities they represent, not by their internal representation in 
the computer.


     One way to declare a 16-bit integer is:


type int16 is range -32768 .. 32767;

      By what miracle could the physical value have this range? The only 
reason to use this kind of data type is to match to hardware interfaces, 
and, in general, they are rather unsigned. In the case described in the 
report, the variable rather seems to be used for internal calculations, 
therefore I don't see any reason to use this kind of data type. Actually 
there is a horrible reason: the program was written in C and then 
translated to Ada either by an automatic translater or by a programmer 
with very little knowledge of the language, and it was never reviewed.


     Languages, either human of computational enforce a way of thinking. 
C and Ada are very different; if you write an Ada program while thinking 
C, it'll be painfull and with no benefit. But it might match the 
requirement to get the contract (just an hypothesis).


     Didier