Re: where exactly c++,c fail and Ada gets thru'



Hi,

jimmaureenrogers@xxxxxxxxxxxxxxxx wrote:

> The C standard explicitly
> allows one to access one element beyond the end of an array to
> support common practice in thousands of C programs.

The "access" word is misleading. It's allowed to use such address for comparisons and in arithemtics. It is *not* allowed to dereference it.

> Polymorphism is one of the heavily used features of C++.

But it is not forced (as is the case in some other "OO" languages).
It is perfectly possible to write programs without the use of run-time polymorphism.

> Safety
> critical software standards require the ability to statically
> determine which function will be called.

It's possible to write such programs in C++.

> Neither C nor C++ provides any standard means for detecting
> overflow or underflow of numeric types.

That's true.

> C provides no way to
> ensure that a numeric type uses only a valid set of values.

True.

> C++
> forces you to define a class wrapping the numeric value.

Yes, classes are used to define new types. Is there any problem with this? It is also necessary in Ada if we want to do just a bit more of what is provided by type and subtype constructs.

> You
> must also provide all the range checking, resulting in a very
> inefficient use of programmer time as well as processor time.

Depends. The former can be automated and the latter can be statically elided. It's all the question of how it's done and templates provide a powerful mechanism that can help here.

> C++ allows you to define a restricted range integer class as a
> template. It does not allow you to define a restricted range
> floating point class because you cannot use floating point
> values as template parameters.

That's true - at least if you require direct use of floating point.

--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
.



Relevant Pages

  • Re: STL-Streams und Unicode/UTF-16
    ... Template von Haus aus eine Eierlegende Wollmilchsau ist. ... eigene Facette schreibt und diese dem Stream gibt. ... codecvt-Facette vorhanden ist (der Standard verlangt das). ...
    (microsoft.public.de.vc)
  • Re: Sine code for ANSI C
    ... >> shell script) fully conforming. ... limits mentioned in the standard. ... adding a few more translation limits. ... minimal accuracy requirements for the floating point operations. ...
    (comp.lang.c)
  • Re: compression in floating point arithmetic
    ... If you want to force floating point values to the same type, ... I was thinking that the sequence point stuff could affect in some way this behaviour, it just seemed very reasonable reading the standard, even if not explicitally stated. ... showed me that in the other way the augmented precision can be carried out. ... Of course you don't need to explain to me the entire standard, there was just a specific point I thought it was saying that the truncation was forbidden, so for me it would have been enough that someone could explain me that in this case that point doesn't apply (like for example Jack did when he showed me that the contraction thing was wrong). ...
    (comp.std.c)
  • Re: Rfd: floating point truncation V1
    ... Some other standard I looked at makes "round towards zero" ... an internal representation of floating point negative zero, "-0E", which differs ... to go for an IEEE FP extension). ...
    (comp.lang.forth)
  • Re: Project 2007: how do I change indicated names of variables?
    ... Unfortunately, it does not work, since also in the copy of "Standard", I am only offered a selection of the original variables, the names of which I cannot change. ... You'll find the Data template used in many circumstances is "Standard" and unfortunately, ... In the Data Template Definition dialog you can select each cell in the box and in the "Show label in cell" enter whatever label you prefer. ... Project MVP ...
    (microsoft.public.project)