[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.programming.threads

Read again, iccorect about C++

Ramine

12/31/2015 6:23:00 PM

Hello.......

I think i am getting crazy with C++, because in
realtime safety critical systems we must take the
programming seriously...

The following is true in C++:

1. C/C++ provide implicit type conversions between signed and unsigned
values. Unlike Ada, there is no a runtime check to make sure the value
is convertible to the new type. For example, you can readily â??convertâ? a
negative signed value to an unsigned value.

Read it here:

http://critical.eschertech.com/2010/04/07/danger-unsigned-types-...


But what i don`t understand is that unsigned int is a good thing
to have to constrain more the system, so how can we say that
we don`t have to use signed int as say the article above...
i am not convinced because if for example we have different
cases in the source code of a realtime safety critical system
that needs to be constrained to an unsigned int by using
an unsigned int on the left of the assignement and we need
also to catch this exception if at runtime we are out of this
constraint and we can catch the exception with FreePascal
with the compiler option -Cr, but in C++ and C we can not
do it, so this is why in my opinion C++ and C are not suitable for
realtime safety critical systems.



Thank you,
Amine Moulay Ramdane.




1 Answer

Ramine

12/31/2015 6:28:00 PM

0



Read again please, i correct...

Hello..

I think i am getting crazy with C++, because in
realtime safety critical systems we must take the
programming seriously...

The following is true in C++:

1. C/C++ provide implicit type conversions between signed and unsigned
values. Unlike Ada, there is no a runtime check to make sure the value
is convertible to the new type. For example, you can readily â??convertâ? a
negative signed value to an unsigned value.

Read it here:

http://critical.eschertech.com/2010/04/07/danger-unsigned-types-...


But what i don`t understand is that unsigned int is a good thing
to have to constrain more the system, so how can we say that
we don`t have to use unsigned int as say the article above...
i am not convinced because if for example we have different
cases in the source code of a realtime safety critical system
that needs to be constrained to an unsigned int by using
an unsigned int on the left of the assignement and we need
also to catch this exception if at runtime we are out of this
constraint and we can catch the exception with FreePascal
with the compiler option -Cr, but in C++ and C we can not
do it, so this is why in my opinion C++ and C are not suitable for
realtime safety critical systems.



Thank you,
Amine Moulay Ramdane.