[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming

Read again my proof...

Ramine

12/28/2015 4:32:00 AM

Hello,


Look at this example in FreePascal and Delphi:

===
program test;

var a:integer;


procedure test(b:Longword);
begin
writeln(b)
end;

begin

a:=-3;

try
test(a);

except
writeln('problem!');
end;
end.

==


If you compile this example in FreePascal with the -Cr option for
range checking, the example above will generate an exception because
at runtime you are trying to pass a negative number to the function
that receive a Longword, that means that receive in C an unsigned long,
so this technic will scale to a much more complex software that
is wrote for realtime safety critical systems.. but in C++ and C you
can not do that, but you can just test for the range of the variables,
but if the software is more complex and you forgot to test the range of
some variables and it causes a catastrophe at runtime, that`s not ok!
but with the technic above in FreePascal, you can catch the exception
easily and you can try to avoid a catastrophe on the realtime safety
critical system.


This is why C and C++ are bad.





Thank you for your time.


Amine Moulay Ramdane.







1 Answer

kenobi

12/29/2015 5:57:00 PM

0

W dniu poniedzialek, 28 grudnia 2015 02:30:57 UTC+1 uzytkownik Ramine napisal:
> Hello,
>
>
> Look at this example in FreePascal and Delphi:
>
> ===
> program test;
>
> var a:integer;
>
>
> procedure test(b:Longword);
> begin
> writeln(b)
> end;
>
> begin
>
> a:=-3;
>
> try
> test(a);
>
> except
> writeln('problem!');
> end;
> end.
>
> ==
>
>
> If you compile this example in FreePascal with the -Cr option for
> range checking, the example above will generate an exception because
> at runtime you are trying to pass a negative number to the function
> that receive a Longword, that means that receive in C an unsigned long,
> so this technic will scale to a much more complex software that
> is wrote for realtime safety critical systems.. but in C++ and C you
> can not do that, but you can just test for the range of the variables,
> but if the software is more complex and you forgot to test the range of
> some variables and it causes a catastrophe at runtime, that`s not ok!
> but with the technic above in FreePascal, you can catch the exception
> easily and you can try to avoid a catastrophe on the realtime safety
> critical system.
>
>
> This is why C and C++ are bad.
>
>
>
>
this proog is worth a Ram (you know male of the sheep not much famous of intelligence)

check it up ram