Hello,
About C++ and Delphi and ADA
As you know i have been programming with Delphi and with C++(i have
implemented many of my scalable algorithms in them) and
i am looking also at ADA and Rust, and what i have discovered
is that C++ is more weakly typed even with the SafeInt library that
i have presented to you here:
https://github.com/dcleblanc/SafeInt
For example you can still assign a type of char to an int type
in C++ and C and C++ and C allow also to assign two structs with some
different types in each one of them that can be assigned ! and this is
not allowed in Delphi and ADA for reliability reasons , because two
structs means two different "types" for Delphi and ADA, Delphi and ADA
doesn't even allow to assign two types of records(that means structs in
C++) that have the same elements with the same types ! but C++ and C
allow it.. so this is why i will stop from using C++ because C++ is less
reliable than ADA or Delphi in this strict-type safety, you can even use
"variants" that are implemented smartly in Delphi to enhance strict-type
safety(and thus reliability) in Delphi as i have showed you like the
following:
--
program test;
uses VARIANTS,SYSUTILS;
var f:double;
a:integer;
FUNCTION ASSIGN(a,B:VARIANT):VARIANT;
begin
IF VARTYPE(A)=VARTYPE(B) THEN
BEGIN
A:=B;
RESULT:=A;
END
ELSE RAISE EXCEPTION.CREATE('ASSIGNEMENT NOT OK');
end;
begin
a:=2;
f:=a;
A:=ASSIGN(F,A);
end.
--
Here is the Vartype function:
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Variants_VarType.html
So i will stop coding in C++ and i will continu to code in Delphi
and i will also code in Java and Rust.
Thank you,
Amine Moulay Ramdane.