[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.programming

I am getting crazy with C++

Ramine

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






4 Answers

Richard Heathfield

12/31/2015 6:28:00 PM

0

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

commodorejohn

12/31/2015 9:14:00 PM

0

Ramine, have you even *worked* with real-time safety-critical systems? I find it hard to imagine that employers in such a field would hire someone who can't formulate a coherent argument, argues from non-sequiturs, considers a link to someone else's article and a brief excerpt of their words to be as good as a proper response, and dismisses any argument he disagrees with as "stupid" without ever providing any reasoning.

Darren Jackson

12/31/2015 10:00:00 PM

0


> "commodorejohn"
> wrote in message
> news:be6c92cf-799f-43eb-a22c-f72782cc77b2@googlegroups.com...

> Ramine, have you even *worked* with real-time safety-critical
> systems? I find it hard to imagine that employers in such a
> field would hire someone who can't formulate a coherent
> argument, argues from non-sequiturs, considers a link to
> someone else's article and a brief excerpt of their words
> to be as good as a proper response, and dismisses any argument
> he disagrees with as "stupid" without ever providing any reasoning.

C++ is fine for hard real time systems:

http://www.stroustrup.com/JSF-AV...

:^)

Kaz Kylheku

12/31/2015 10:31:00 PM

0

On 2015-12-31, commodorejohn <commodorejohn@gmail.com> wrote:
> Ramine, have you even *worked* with real-time safety-critical systems?

Ramine is a hobby programmer, not an actual developer of safety critical
or non-critical anything.

I can't see his postings because they are blacklisted from the server
I'm using (or its upstreams); the only problem are people replying to
the crap, without whom it would be completely invisible.