What is needed to write data-safe applications in C ++?

Is it possible to create a coding standard or use a library that can be proved to eliminate any memory management errors in C ++?

I am thinking of something like Java, it is simply impossible, for example, to break pointers in Java applications.

+4
source share
2 answers

Is it possible to create a coding standard or use a library that can be proved to eliminate any memory management errors in C ++?

Yes and no.

, ++. , Power of Ten ( ) , . .

, , , ...

, , , , , .

:

  • , , , , . .
  • , , , .
  • , , , shared_ptr, unique_ptr .. , , , . (, shared_ptr , ...)
  • , valgrind, , .

, . , . , , .

+6

, ++?

.

Java.. Java , ( ), .

, Android, - , , . , - , . , .

, ( ), . ; , .

, , Java , - , , . , (, NullPointerException) , .


.

, , . ++, :

  • (, std::vector std::set), .
  • . .
  • , std::unique_ptr.
  • , std::shared_ptr.
  • new, , (, std::vector std::set) . .

Boehm ++, .

+1

Source: https://habr.com/ru/post/1666619/


All Articles