Monday, December 28, 2015

Digest for comp.lang.c++@googlegroups.com - 5 updates in 5 topics

Mr Flibble <flibble@i42.co.uk>: Dec 28 06:49PM

On 28/12/2015 20:24, Ramine wrote:
> -Co, and that's better in FreePascal for realtime safety critical
> systems, note also that i have just tested FreePascal with -Co and it
> works for both overflow of a signed int or an unsigned int.
 
Your basic point which you are annoyingly repeatedly expressing in
various different but similar ways as extremely annoying spam posts is
that C++ has undefined behaviour. The presence of undefined behaviour
bestows certain benefits to C++ the primary one being that of
performance. Languages which lack undefined behaviour tend to be much
slower than those that do such as C++.
 
Although the C++ language benefits from having undefined behaviour
actually invoking it is a BUG so the question as to whether a language
with undefined behaviour can be used in safety critical systems is
answered by the realisation that you can also create bugs in a language
with no undefined behaviour.
 
So instead of banging on about C++ you should restrict your argument to
languages in general that either do or don't exhibit undefined behaviour
and how bugs manifest in those languages sausages.
 
/Flibble
Ramine <ramine@1.1>: Dec 28 12:54PM -0800

Hello.....
 
 
Here is the exception that you can catch in FreePascal if
you compile with the -Co option:
 
 
try
 
except
on EIntOverflow do HandleIntOverflow;
end;
 
 
And that's better than C++ and C, because on a more complex realtime
safety critical systems if you forget to test the overflow or underflow
you can risk more , but in FreePascal you can also catch the
EIntOverflow exception and this exception works for both
signed and unsigned 32 bit or 64 bit variables for multiplication
division and add etc. and that's better than C++ and C.
 
 
 
Thank you,
Amine Moulay Ramdane.
bleachbot <bleachbot@httrack.com>: Dec 28 06:54PM +0100

Ramine <ramine@1.1>: Dec 27 08:40PM -0800

Hello,
 
 
If you have read my previous post of my proof, what i mean is:
 
The freedom that give us C++ and C is not acceptable for realtime safety
critical systems !
 
 
Thank you,
Amine Moulay Ramdane.
Ramine <ramine@1.1>: Dec 27 08:31PM -0800

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.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: