Richard Heathfield
12/31/2015 6:28:00 PM
On 31/12/15 18:16, Ramine wrote:
> Hello,
>
> I think i am getting crazy with C++,
If that's a problem, don't use C++.
> because in
> realtime safety critical systems we must take the
> programming seriously...
We should take *all* programming seriously, shouldn't we?
> 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.
That's perfectly true. For example:
unsigned long maxval = -1;
That's a good thing, not a bad thing.
>
> Read it here:
No. If you have something to say, say it here. Don't send us all over
the Web on a wild goose chase. It's pointless and stupid.
> But what i don`t understand is that signed int is a good thing
If you want to be able to represent negative integers, signed int is a
good thing to have.
> 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...
So you disagree with the article. Fine. Take it up with the author.
> 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,
None of that makes any sense.
> but in C++ and C we can not
> do it,
You're wrong. We can if we want to. We generally choose not to.
> so this is why in my opinion C++ and C are not suitable for
> realtime safety critical systems.
So you've changed your mind again. You might want to think this stuff
through instead of making an idiot of yourself on Usenet by changing
your mind every few hours.
--
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