Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #4318

I think C++ and C have many problems

From Sky89 <Sky89@sky68.com>
Newsgroups comp.programming.threads
Subject I think C++ and C have many problems
Date 2018-05-20 19:06 -0400
Organization A noiseless patient Spider
Message-ID <pdsgv1$rp3$2@dont-email.me> (permalink)

Show all headers | View raw


Hello..


I think C++ and C have many problems because they are "too" weakly 
typed, here is another problem of C++ and C, look at this C++ example:


===

#include <conio.h>
#include <iostream>
using namespace std;
#include <stdint.h>



double y;


void a1(unsigned int a)
{
cout << a  ;

}

int main()
{

unsigned int b;
int a;



y=3.4;


a1(y);


}

==


This will be accepted by C++ because the parameter a of a1() will equal 
3, but this is "not" correct for "reliability" and it is not accepted by 
Delphi and FreePascal and ADA because they are more strongly typed than 
C++ and C and they will give an error that the type of the parameter a 
of a1() is not the same as the type of y.


Also Delphi and FreePascal like ADA come with range checking and 
Run-time checks that catch conversion from negative signed to unsigned , 
and catch out-of-bounds indices of dynamic and static arrays and catch 
arithmetic overflow etc. and you can also dynamically catch this 
exception of ERangeError etc.

But C++ and C don't have range checking and don't many Run-time checks 
etc. so that's not good in C++ and C because it is not good for 
reliability and it is not good for safety-critical systems.

You can carefully read the following, it is very important:

https://critical.eschertech.com/2010/07/07/run-time-checks-are-they-worth-it/


And about Escher C++ Verifier, read carefully:

"Escher C Verifier enables the development of formally-verifiable 
software in a subset of C (based on MISRA-C 2012)."

Read here:

http://www.eschertech.com/products/index.php


So it verifies just a "subset" of C, so that's not good for C++
because for other applications that are not a subset of C , it can
not do for example Run-time checks, so we are again into
this problem again that  C++ and C don't have range checking and many 
Run-time checks, so that's not good in C++ and C because it is not good 
for reliability and it is not good for safety-critical systems.



Thank you,
Amine Moulay Ramdane.


Back to comp.programming.threads | Previous | Next | Find similar | Unroll thread


Thread

I think C++ and C have many problems Sky89 <Sky89@sky68.com> - 2018-05-20 19:06 -0400

csiph-web