[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.programming

Read again, i correct 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.




2 Answers

Ramine

12/31/2015 6:27: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.




Richard Heathfield

12/31/2015 6:30:00 PM

0

On 31/12/15 18:22, Ramine wrote:
> Hello.....
>
> I think i am getting crazy with C++,

If you want to post a correction, do it in a followup article, not a new
thread.

You were already told about this. You are demonstrating a remarkable
inability to learn from experience.

--
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within