- cmsg cancel <n61897$6ki$2@dont-email.me> - 3 Updates
- Please read again, i correct about C++ - 1 Update
- Here is my conclusion about C++ - 1 Update
- Read again about my objection about C++ and C - 1 Update
bleachbot <bleachbot@httrack.com>: Dec 30 07:40PM +0100 |
bleachbot <bleachbot@httrack.com>: Dec 30 09:00PM +0100 |
bleachbot <bleachbot@httrack.com>: Dec 30 09:07PM +0100 |
Ramine <ramine@1.1>: Dec 30 03:07PM -0800 Hello, I think C++ is good for realtime safety critical systems, because: 1- You can enforce the strong typing of Ada by using object oriented programming. 2- And you can avoid signed or unsigned int overflow and underflow by using a secure library that uses operator overloading with the right tests inside them that catch the signed or unsigned int overflow and underflow. So the case is closed ! so i am convinced now that C++ is good for realtime safety critical systems. Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Dec 30 03:00PM -0800 Hello, I think C++ is good for reatime safety critical systems, because: 1- You can enforce the strong typing of Ada by using object oriented programming. 2- And you can avoid signed or unsigned int overflow and underflow by using a secure library that uses operator overloading with the right tests inside them that catch the signed or unsigned int overflow and underflow. So the case is claused ! so i am convinced now that C++ is good for reatime safety critical systems. Thank you, Amine Moulay Ramdane. |
Ramine <ramine@1.1>: Dec 30 01:40PM -0800 Hello.... I have just took a look to operator overloading in FreePascal and Delphi, so look at how powerful it is, here is an example: === program OperatorsTest; {$APPTYPE CONSOLE} uses SysUtils; type TIntValue = record private FValue: Integer; public class operator Add(const a, b: TIntValue): TIntValue; class operator Implicit(const a: Integer): TIntValue; class operator Implicit(const a: TIntValue): Integer; property Value: Integer read FValue; end; { TIntValue } class operator TIntValue.Add(const a, b: TIntValue): TIntValue; begin Result.FValue := a.FValue + b.FValue; end; class operator TIntValue.Implicit(const a: Integer): TIntValue; begin Result.FValue := a; end; class operator TIntValue.Implicit(const a: TIntValue): Integer; begin Result := a.FValue; end; var Int: TIntValue; begin Int := 5; Int := Int + 10; WriteLn(IntToStr(Int)); end. === You can overload the following operators in both FreePascal and Delphi, read here: http://docwiki.embarcadero.com/RADStudio/Seattle/en/Operator_Overloading_(Delphi) In ADA when you define two types like this: type length is new float; type weight is new float; You can not assign type length to type weight, this strong typing of Ada you can do it easily with object oriented programming in FreePascal and Delphi and C++. So what remains about C and C++ is that in C++ and C you can not at runtime catch the exception of signed int or unsigned int overflow or underflow , this is a weakness in C++ and C , but in FreePascal and Delphi you can easily do it by compiling with the FreePasal compiler option -Co, after that you can catch the exception named EIntOverflow like this: try except on EIntOverflow do HandleIntOverflow; end; And the HandleIntOverflow you can reraise the exception by returning the name of the function that raised this exception of the signed or unsigned int overflow or underflow so that to catch the bugs easily and that's good in realtime safety critical systems, so C++ and C can not do that and this is not suitable for realtime safety critical system. Thank you, 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.programming.threads+unsubscribe@googlegroups.com. |
No comments:
Post a Comment