SlideShare a Scribd company logo
1 of 106
Typical errors in code on the example of
C++, C#, and Java
Information Technology Video Developer Network
Информационный
видеосервис
для
разработчиков
программного
обеспечения
http://itvdn.com
Георгий Грибков
About the speaker
Information Technology Video Developer Network http://itvdn.com
ITVDN
C++ developer of the PVS-Studio static code analyzer
• Develops the analyzer core, new diagnostics, supports users.
• Introduced PVS-Studio in the godbolt.org online compiler.
• Wrote articles for the Habr website and gave talks at IT conferences,
related to searching for bugs in code.
Typical errors in code on the example of C++, C#, and Java
Agenda
Information Technology Video Developer Network http://itvdn.com
ITVDN
1. Objectives of this webinar
2. How we detected error patterns
3. Patterns themselves and how to avoid them:
3.1 Copy-paste and last line effect
3.2 if (A) {...} else if (A)
3.3 Errors in checks
3.4 Array index out of bounds
3.5 Operator precedence
3.6 Typos that are hard to spot
4. How to use static analysis properly
5. Conclusion
6. Q&A
Заключение
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
More than 50 video courses for C# developers at ITVDN
C# Basics
Author: Alexander Shevchuk
Duration: 16 h 3 mins
9 lessons
C# Basic (OOP)
Author: Alexander Shevchuk
Duration: 31 h 26 mins
18 lessons
C# for professionals
Author: Oleg Kulygin
Duration: 19 h 38 mins
17 lessons
C# Generics
Author: Nikolay Melnichuk
Duration: 4 h 49 mins
7 lessons
Unit testing in C#
Author: Dmitry Okhrimenko
Duration: 3 h 48 mins
3 lessons
.NET Apps
Refactoring
Author: David Boyarov
Duration: 6 h 41 mins, 5 lessons
Information Technology Video Developer Network http://itvdn.com
ITVDN
More than 26 video courses for Java developers at ITVDN
Java Starter
Author: Evgeny Tikhonov
Duration: 9 h 46 mins
9 lessons
Java Essential
Author: Evgeny Tikhonov
Duration: 11 h 10 mins
10 lessons
Java Professional
Author : Evgeny Tikhonov
Duration: 20 h 18 mins
15 lessons
SOLID principles in Java
Author: Andrey Fok
Duration: 2 h 45 mins
5 lessons
Unit testing in Java with JUnit
Author: Mikhail Skafenko
Duration: 2 h 33 mins
7 lessons
Java EE Basics
Author: Andrey Bondarenko
Duration: 18 h 50 mins
12 lessons
Information Technology Video Developer Network http://itvdn.com
ITVDN
Video courses for C++ developers at ITVDN
C++ Starter
Author: Vladimir Vinogradov
Duration: 8 h 13 mins
13 lessons
QT Framework
Author: Ruslan Larionenko
Duration: 6 h 27 mins
10 lessons
C++ Essential
Author: Kirill Chernega
Duration: 4 h 38 mins
8 lessons
C++Advanced
Author: Kirill Chernega
Duration: 8 h 17 mins
11 lessons
Complete practical tasks in C++
Author: Naumenko Alexander
Duration: 4 h 39 mins, 7 lessons
STL - Standard Template Library
Author: Pavlenko Alexander
Duration: 7 h 5 mins, 12 lessons
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
*
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
BUGS ARE EVERYWHERE!
Typical errors in code on the example of C++, C#, and Java
How to avoid errors
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Warn developers of typical problems
• Use tools to automatically search for errors
Typical errors in code on the example of C++, C#, and Java
Objectives of this webinar
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Demonstrate typical error patterns in code
• Show how to use static analysis properly
Typical errors in code on the example of C++, C#, and Java
2. How we detected error patterns
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
What is static analysis
Information Technology Video Developer Network http://itvdn.com
ITVDN
Static analysis is automated code review.
Typical errors in code on the example of C++, C#, and Java
What is static analysis
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Examples of static analyzers
Information Technology Video Developer Network http://itvdn.com
ITVDN
• PVS-Studio
• Cppcheck
• Infer
• IntelliJ IDEA
• Clang Static Analyzer
• FindBugs
• ...
Long list of static analyzers:
Typical errors in code on the example of C++, C#, and Java
How we detected error patterns
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Found errors
380 13747
Checked
projects
Detected
errors
Check out the base of errors we found:
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
3. Patterns themselves and how to avoid them
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Pattern № 1:
Copy-paste and last line effect
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V6039 There are two 'if' statements with identical
conditional expressions. The first 'if' statement
contains method return. This means that the
second 'if' statement is senseless.
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Clang (C++)
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Clang (C++)
PVS-Studio warning: V501 There are identical sub-expressions
SM.getExpansionColumnNumber(ContainerREnd)' to the left and to the right of the '>=' operator.
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Clang (C++)
PVS-Studio warning: V501 There are identical sub-expressions
SM.getExpansionColumnNumber(ContainerREnd)' to the left and to the right of the '>=' operator.
Typical errors in code on the example of C++, C#, and Java
Xenko Game Engine (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Xenko Game Engine (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning: V3001 There are
identical sub-expressions 'box.Maximum.X
- box.Minimum.X > sphere.Radius' to the
left and to the right of the '&&' operator.
Typical errors in code on the example of C++, C#, and Java
Pattern № 1: Copy-paste and last line effect
Information Technology Video Developer Network http://itvdn.com
ITVDN
• We selected 84 examples of erroneous code
written with copy-paste
• 43 of them had an error in the last line!
• It is more than 50%!
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Stop copy-pasting
• Copy-pasting in programming is pure evil!
• If you dare to – be extremely attentive
How to avoid
Typical errors in code on the example of C++, C#, and Java
Pattern № 2.
if (A) {...} else if (A)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V6003 The use of 'if (A) {....} else if (A)
{....}' pattern was detected. There is a
probability of logical error presence.
Typical errors in code on the example of C++, C#, and Java
Chromium (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Chromium (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V517 The use of 'if (A) {...} else if (A)
{...}' pattern was detected. There is a
probability of logical error presence.
Check lines: 61, 63.
Typical errors in code on the example of C++, C#, and Java
CryEngine V (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
CryEngine V (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V517 The use of 'if (A) {...} else if (A)
{...}' pattern was detected. There is a
probability of logical error presence.
Check lines: 266, 268.
Typical errors in code on the example of C++, C#, and Java
CryEngine V (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V517 The use of 'if (A) {...} else if (A)
{...}' pattern was detected. There is a
probability of logical error presence.
Check lines: 266, 268.
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
MonoDevelop (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V3021 There are two 'if' statements
with identical conditional
expressions. The first 'if' statement
contains method return. This means
that the second 'if' statement is
senseless.
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Try to do best not to copy-paste
• If you’re still going to copy-paste, copy non-compiled constructions.
• Example:
if (value == _)
return _;
How to avoid?
Typical errors in code on the example of C++, C#, and Java
Pattern № 3.
Errors in checks
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Unity (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Unity (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V3063 A part of conditional
expression is always true if it is
evaluated: pageSize <= 1000.
Typical errors in code on the example of C++, C#, and Java
Bullet - the engine of Red Dead Redemption (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Bullet - the engine of Red Dead Redemption (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V709 Suspicious comparison found:
'f0 == f1 == m_fractureBodies.size()’.
Remember that
'a == b == c’
is not equal to
'a == b && b == c'.
Typical errors in code on the example of C++, C#, and Java
Apache Hive (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Apache Hive (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning: V6030 The method located to the right of the '|' operator will be called regardless of
the value of the left operand. Perhaps, it is better to use '||'.
Typical errors in code on the example of C++, C#, and Java
Chromium (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Chromium (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Chromium (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warnings:
 V547 Expression
'time.month <=
kDaysInMonth[time.month] + 1' is
always true.
 V547 Expression
'time.month <=
kDaysInMonth[time.month]’
is always true.
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
• «Pay attention!» won’t work every time 
• Try backup tools
How to avoid
Typical errors in code on the example of C++, C#, and Java
Pattern № 4.
Array index out of bounds
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Stickies (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Stickies (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V557 Array overrun is possible. The
'64' index is pointing beyond array
bound. stickies stickies.cpp
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning: V6025 Possibly index '(int) x' is out of bounds.
Typical errors in code on the example of C++, C#, and Java
Elasticsearch (Java)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning: V6025 Possibly index '(int) x' is out of bounds.
Typical errors in code on the example of C++, C#, and Java
IPP Samples (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
IPP Samples (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
IPP Samples (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
IPP Samples (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
IPP Samples (C++)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V557 Array overrun is possible. The '30'
index is pointing beyond array bound.
Typical errors in code on the example of C++, C#, and Java
FastReport (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
FastReport (C#)
Information Technology Video Developer Network http://itvdn.com
ITVDN
PVS-Studio warning:
V3106 Possible negative index value. The value
of 'idx' index could reach -1.
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Be careful when you add '0’ to the end of the string
• Do you get an external index? Make sure you check it!
• Don’t mix up '>' ('<‘) and '>=' ('<=‘) when comparing the index with the array size
How to avoid
Typical errors in code on the example of C++, C#, and Java
4. How to use static analysis properly
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
When you should perform static analysis
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
When you should perform static analysis
Information Technology Video Developer Network http://itvdn.com
ITVDN
Static analysis
Typical errors in code on the example of C++, C#, and Java
How to make the most of static analysis
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Apply static analysis at early stages
• Analyze regularly
Typical errors in code on the example of C++, C#, and Java
Proprietary development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Proprietary development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Proprietary development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Proprietary development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Proprietary development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Corporate development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Open-source development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Open-source development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Open-source development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Open-source development
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
More about analysis of commits and pull-requests
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
5. Conclusion
Information Technology Video Developer Network http://itvdn.com
ITVDN
Typical errors in code on the example of C++, C#, and Java
Typical error patterns in code
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Copy-paste and last line effect
• if (A) {...} else if (A)
• Errors in checks
• Array index out of bounds
• … (the list gradually expands)
Typical errors in code on the example of C++, C#, and Java
How to avoid typical errors
Information Technology Video Developer Network http://itvdn.com
ITVDN
• Stop copy-pasting!
• Seriously, stop copy-pasting!
• Pay attention to checks, even small and short ones.
• Carefully check array indexes.
• Regularly use static analysis.
Typical errors in code on the example of C++, C#, and Java
Free PVS-Studio license for students
Information Technology Video Developer Network http://itvdn.com
ITVDN
https://bit.ly/pvs-student
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Q&A
Typical errors in code on the example of C++, C#, and Java
Information Technology Video Developer Network http://itvdn.com
ITVDN
Watch our video lessons on C++
At ITVDN you’ll find a collection of video courses and webinars for C++ developers.
Go to ITVDN.com and watch our video lessons right now!
IT VIDEO DEVELOPERS NETWORK
Information Technology Video Developer Network http://itvdn.com
ITVDN

More Related Content

Similar to Typical errors in code on the example of C++, C#, and Java

All about PVS-Studio
All about PVS-StudioAll about PVS-Studio
All about PVS-StudioPVS-Studio
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
 
Firmware Co-Design & Development for IP Cores in C++/SystemC using Verilator
Firmware Co-Design & Development for IP Cores in C++/SystemC using VerilatorFirmware Co-Design & Development for IP Cores in C++/SystemC using Verilator
Firmware Co-Design & Development for IP Cores in C++/SystemC using VerilatorSeyed Amir Alavi
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
From V8 to Modern Compilers
From V8 to Modern CompilersFrom V8 to Modern Compilers
From V8 to Modern CompilersMin-Yih Hsu
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDevOps Indonesia
 
Waiting for a cyber range exercise is not enough
Waiting for a cyber range exercise is not enoughWaiting for a cyber range exercise is not enough
Waiting for a cyber range exercise is not enoughOlafSchwarz1
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programmingmaznabili
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptKevin Read
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Kevin Read
 
Profiling distributed Java applications
Profiling distributed Java applicationsProfiling distributed Java applications
Profiling distributed Java applicationsConstantine Slisenka
 
Static analysis as means of improving code quality
Static analysis as means of improving code quality Static analysis as means of improving code quality
Static analysis as means of improving code quality Andrey Karpov
 
Letter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLetter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLazar Kovacevic
 
Continuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsContinuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsMark Rendell
 
OpenCV (Open source computer vision)
OpenCV (Open source computer vision)OpenCV (Open source computer vision)
OpenCV (Open source computer vision)Chetan Allapur
 
Be armed to the teeth to maintain a high quality iOS code
Be armed to the teeth to maintain a high quality iOS codeBe armed to the teeth to maintain a high quality iOS code
Be armed to the teeth to maintain a high quality iOS codeAnastasia Kazakova
 
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise ApplicationsDaniel Oh
 

Similar to Typical errors in code on the example of C++, C#, and Java (20)

Aicas, Inc.
Aicas, Inc.Aicas, Inc.
Aicas, Inc.
 
aicas, inc.
aicas, inc.aicas, inc.
aicas, inc.
 
All about PVS-Studio
All about PVS-StudioAll about PVS-Studio
All about PVS-Studio
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
 
Firmware Co-Design & Development for IP Cores in C++/SystemC using Verilator
Firmware Co-Design & Development for IP Cores in C++/SystemC using VerilatorFirmware Co-Design & Development for IP Cores in C++/SystemC using Verilator
Firmware Co-Design & Development for IP Cores in C++/SystemC using Verilator
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
From V8 to Modern Compilers
From V8 to Modern CompilersFrom V8 to Modern Compilers
From V8 to Modern Compilers
 
Developer-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for KubernetesDeveloper-Friendly CI / CD for Kubernetes
Developer-Friendly CI / CD for Kubernetes
 
Waiting for a cyber range exercise is not enough
Waiting for a cyber range exercise is not enoughWaiting for a cyber range exercise is not enough
Waiting for a cyber range exercise is not enough
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programming
 
How I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScriptHow I learned to stop worrying and love embedding JavaScript
How I learned to stop worrying and love embedding JavaScript
 
Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8Embedding V8 in Android apps with Ejecta-V8
Embedding V8 in Android apps with Ejecta-V8
 
Profiling distributed Java applications
Profiling distributed Java applicationsProfiling distributed Java applications
Profiling distributed Java applications
 
Static analysis as means of improving code quality
Static analysis as means of improving code quality Static analysis as means of improving code quality
Static analysis as means of improving code quality
 
C# 4.0 - Whats New
C# 4.0 - Whats NewC# 4.0 - Whats New
C# 4.0 - Whats New
 
Letter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of ProgrammingLetter to a Junior Developer: The Engineering Side of Programming
Letter to a Junior Developer: The Engineering Side of Programming
 
Continuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsContinuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations Teams
 
OpenCV (Open source computer vision)
OpenCV (Open source computer vision)OpenCV (Open source computer vision)
OpenCV (Open source computer vision)
 
Be armed to the teeth to maintain a high quality iOS code
Be armed to the teeth to maintain a high quality iOS codeBe armed to the teeth to maintain a high quality iOS code
Be armed to the teeth to maintain a high quality iOS code
 
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications[RHFSeoul2017]6 Steps to Transform Enterprise Applications
[RHFSeoul2017]6 Steps to Transform Enterprise Applications
 

More from Andrey Karpov

60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста60 антипаттернов для С++ программиста
60 антипаттернов для С++ программистаAndrey Karpov
 
60 terrible tips for a C++ developer
60 terrible tips for a C++ developer60 terrible tips for a C++ developer
60 terrible tips for a C++ developerAndrey Karpov
 
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Andrey Karpov
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesAndrey Karpov
 
PVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewPVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewAndrey Karpov
 
PVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокPVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокAndrey Karpov
 
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Andrey Karpov
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesAndrey Karpov
 
Does static analysis need machine learning?
Does static analysis need machine learning?Does static analysis need machine learning?
Does static analysis need machine learning?Andrey Karpov
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)Andrey Karpov
 
Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Andrey Karpov
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerAndrey Karpov
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareAndrey Karpov
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineAndrey Karpov
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsAndrey Karpov
 
The Great and Mighty C++
The Great and Mighty C++The Great and Mighty C++
The Great and Mighty C++Andrey Karpov
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?Andrey Karpov
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youAndrey Karpov
 
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsPVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsAndrey Karpov
 

More from Andrey Karpov (20)

60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста60 антипаттернов для С++ программиста
60 антипаттернов для С++ программиста
 
60 terrible tips for a C++ developer
60 terrible tips for a C++ developer60 terrible tips for a C++ developer
60 terrible tips for a C++ developer
 
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...Ошибки, которые сложно заметить на code review, но которые находятся статичес...
Ошибки, которые сложно заметить на code review, но которые находятся статичес...
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
PVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature OverviewPVS-Studio in 2021 - Feature Overview
PVS-Studio in 2021 - Feature Overview
 
PVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибокPVS-Studio в 2021 - Примеры ошибок
PVS-Studio в 2021 - Примеры ошибок
 
PVS-Studio в 2021
PVS-Studio в 2021PVS-Studio в 2021
PVS-Studio в 2021
 
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Does static analysis need machine learning?
Does static analysis need machine learning?Does static analysis need machine learning?
Does static analysis need machine learning?
 
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
 
Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?Game Engine Code Quality: Is Everything Really That Bad?
Game Engine Code Quality: Is Everything Really That Bad?
 
C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
 
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source SoftwareThe Use of Static Code Analysis When Teaching or Developing Open-Source Software
The Use of Static Code Analysis When Teaching or Developing Open-Source Software
 
Static Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal EngineStatic Code Analysis for Projects, Built on Unreal Engine
Static Code Analysis for Projects, Built on Unreal Engine
 
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
 
The Great and Mighty C++
The Great and Mighty C++The Great and Mighty C++
The Great and Mighty C++
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
Zero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for youZero, one, two, Freddy's coming for you
Zero, one, two, Freddy's coming for you
 
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOpsPVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
PVS-Studio Is Now in Chocolatey: Checking Chocolatey under Azure DevOps
 

Recently uploaded

Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2
 

Recently uploaded (20)

Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
WSO2Con2024 - Simplified Integration: Unveiling the Latest Features in WSO2 L...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 

Typical errors in code on the example of C++, C#, and Java

  • 1. Typical errors in code on the example of C++, C#, and Java Information Technology Video Developer Network Информационный видеосервис для разработчиков программного обеспечения http://itvdn.com
  • 2. Георгий Грибков About the speaker Information Technology Video Developer Network http://itvdn.com ITVDN C++ developer of the PVS-Studio static code analyzer • Develops the analyzer core, new diagnostics, supports users. • Introduced PVS-Studio in the godbolt.org online compiler. • Wrote articles for the Habr website and gave talks at IT conferences, related to searching for bugs in code. Typical errors in code on the example of C++, C#, and Java
  • 3. Agenda Information Technology Video Developer Network http://itvdn.com ITVDN 1. Objectives of this webinar 2. How we detected error patterns 3. Patterns themselves and how to avoid them: 3.1 Copy-paste and last line effect 3.2 if (A) {...} else if (A) 3.3 Errors in checks 3.4 Array index out of bounds 3.5 Operator precedence 3.6 Typos that are hard to spot 4. How to use static analysis properly 5. Conclusion 6. Q&A Заключение Typical errors in code on the example of C++, C#, and Java
  • 4. Information Technology Video Developer Network http://itvdn.com ITVDN More than 50 video courses for C# developers at ITVDN C# Basics Author: Alexander Shevchuk Duration: 16 h 3 mins 9 lessons C# Basic (OOP) Author: Alexander Shevchuk Duration: 31 h 26 mins 18 lessons C# for professionals Author: Oleg Kulygin Duration: 19 h 38 mins 17 lessons C# Generics Author: Nikolay Melnichuk Duration: 4 h 49 mins 7 lessons Unit testing in C# Author: Dmitry Okhrimenko Duration: 3 h 48 mins 3 lessons .NET Apps Refactoring Author: David Boyarov Duration: 6 h 41 mins, 5 lessons
  • 5. Information Technology Video Developer Network http://itvdn.com ITVDN More than 26 video courses for Java developers at ITVDN Java Starter Author: Evgeny Tikhonov Duration: 9 h 46 mins 9 lessons Java Essential Author: Evgeny Tikhonov Duration: 11 h 10 mins 10 lessons Java Professional Author : Evgeny Tikhonov Duration: 20 h 18 mins 15 lessons SOLID principles in Java Author: Andrey Fok Duration: 2 h 45 mins 5 lessons Unit testing in Java with JUnit Author: Mikhail Skafenko Duration: 2 h 33 mins 7 lessons Java EE Basics Author: Andrey Bondarenko Duration: 18 h 50 mins 12 lessons
  • 6. Information Technology Video Developer Network http://itvdn.com ITVDN Video courses for C++ developers at ITVDN C++ Starter Author: Vladimir Vinogradov Duration: 8 h 13 mins 13 lessons QT Framework Author: Ruslan Larionenko Duration: 6 h 27 mins 10 lessons C++ Essential Author: Kirill Chernega Duration: 4 h 38 mins 8 lessons C++Advanced Author: Kirill Chernega Duration: 8 h 17 mins 11 lessons Complete practical tasks in C++ Author: Naumenko Alexander Duration: 4 h 39 mins, 7 lessons STL - Standard Template Library Author: Pavlenko Alexander Duration: 7 h 5 mins, 12 lessons
  • 7. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 8. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 9. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 10. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 11. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 12. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 13. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 14. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 15. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 16. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 17. Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 18. Information Technology Video Developer Network http://itvdn.com ITVDN * Typical errors in code on the example of C++, C#, and Java
  • 19. Information Technology Video Developer Network http://itvdn.com ITVDN BUGS ARE EVERYWHERE! Typical errors in code on the example of C++, C#, and Java
  • 20. How to avoid errors Information Technology Video Developer Network http://itvdn.com ITVDN • Warn developers of typical problems • Use tools to automatically search for errors Typical errors in code on the example of C++, C#, and Java
  • 21. Objectives of this webinar Information Technology Video Developer Network http://itvdn.com ITVDN • Demonstrate typical error patterns in code • Show how to use static analysis properly Typical errors in code on the example of C++, C#, and Java
  • 22. 2. How we detected error patterns Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 23. What is static analysis Information Technology Video Developer Network http://itvdn.com ITVDN Static analysis is automated code review. Typical errors in code on the example of C++, C#, and Java
  • 24. What is static analysis Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 25. Examples of static analyzers Information Technology Video Developer Network http://itvdn.com ITVDN • PVS-Studio • Cppcheck • Infer • IntelliJ IDEA • Clang Static Analyzer • FindBugs • ... Long list of static analyzers: Typical errors in code on the example of C++, C#, and Java
  • 26. How we detected error patterns Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java Found errors 380 13747 Checked projects Detected errors
  • 27. Check out the base of errors we found: Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 28. 3. Patterns themselves and how to avoid them Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 29. Pattern № 1: Copy-paste and last line effect Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 30. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 31. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V6039 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains method return. This means that the second 'if' statement is senseless. Typical errors in code on the example of C++, C#, and Java
  • 32. Information Technology Video Developer Network http://itvdn.com ITVDN Clang (C++) Typical errors in code on the example of C++, C#, and Java
  • 33. Information Technology Video Developer Network http://itvdn.com ITVDN Clang (C++) PVS-Studio warning: V501 There are identical sub-expressions SM.getExpansionColumnNumber(ContainerREnd)' to the left and to the right of the '>=' operator. Typical errors in code on the example of C++, C#, and Java
  • 34. Information Technology Video Developer Network http://itvdn.com ITVDN Clang (C++) PVS-Studio warning: V501 There are identical sub-expressions SM.getExpansionColumnNumber(ContainerREnd)' to the left and to the right of the '>=' operator. Typical errors in code on the example of C++, C#, and Java
  • 35. Xenko Game Engine (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 36. Xenko Game Engine (C#) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V3001 There are identical sub-expressions 'box.Maximum.X - box.Minimum.X > sphere.Radius' to the left and to the right of the '&&' operator. Typical errors in code on the example of C++, C#, and Java
  • 37. Pattern № 1: Copy-paste and last line effect Information Technology Video Developer Network http://itvdn.com ITVDN • We selected 84 examples of erroneous code written with copy-paste • 43 of them had an error in the last line! • It is more than 50%! Typical errors in code on the example of C++, C#, and Java
  • 38. Information Technology Video Developer Network http://itvdn.com ITVDN • Stop copy-pasting • Copy-pasting in programming is pure evil! • If you dare to – be extremely attentive How to avoid Typical errors in code on the example of C++, C#, and Java
  • 39. Pattern № 2. if (A) {...} else if (A) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 40. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 41. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V6003 The use of 'if (A) {....} else if (A) {....}' pattern was detected. There is a probability of logical error presence. Typical errors in code on the example of C++, C#, and Java
  • 42. Chromium (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 43. Chromium (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 61, 63. Typical errors in code on the example of C++, C#, and Java
  • 44. CryEngine V (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 45. CryEngine V (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 266, 268. Typical errors in code on the example of C++, C#, and Java
  • 46. CryEngine V (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 266, 268. Typical errors in code on the example of C++, C#, and Java
  • 47. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 48. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 49. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 50. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 51. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 52. MonoDevelop (C#) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V3021 There are two 'if' statements with identical conditional expressions. The first 'if' statement contains method return. This means that the second 'if' statement is senseless. Typical errors in code on the example of C++, C#, and Java
  • 53. Information Technology Video Developer Network http://itvdn.com ITVDN • Try to do best not to copy-paste • If you’re still going to copy-paste, copy non-compiled constructions. • Example: if (value == _) return _; How to avoid? Typical errors in code on the example of C++, C#, and Java
  • 54. Pattern № 3. Errors in checks Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 55. Unity (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 56. Unity (C#) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V3063 A part of conditional expression is always true if it is evaluated: pageSize <= 1000. Typical errors in code on the example of C++, C#, and Java
  • 57. Bullet - the engine of Red Dead Redemption (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 58. Bullet - the engine of Red Dead Redemption (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V709 Suspicious comparison found: 'f0 == f1 == m_fractureBodies.size()’. Remember that 'a == b == c’ is not equal to 'a == b && b == c'. Typical errors in code on the example of C++, C#, and Java
  • 59. Apache Hive (Java) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 60. Apache Hive (Java) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V6030 The method located to the right of the '|' operator will be called regardless of the value of the left operand. Perhaps, it is better to use '||'. Typical errors in code on the example of C++, C#, and Java
  • 61. Chromium (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 62. Chromium (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 63. Chromium (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warnings:  V547 Expression 'time.month <= kDaysInMonth[time.month] + 1' is always true.  V547 Expression 'time.month <= kDaysInMonth[time.month]’ is always true. Typical errors in code on the example of C++, C#, and Java
  • 64. Information Technology Video Developer Network http://itvdn.com ITVDN • «Pay attention!» won’t work every time  • Try backup tools How to avoid Typical errors in code on the example of C++, C#, and Java
  • 65. Pattern № 4. Array index out of bounds Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 66. Stickies (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 67. Stickies (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V557 Array overrun is possible. The '64' index is pointing beyond array bound. stickies stickies.cpp Typical errors in code on the example of C++, C#, and Java
  • 68. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 69. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V6025 Possibly index '(int) x' is out of bounds. Typical errors in code on the example of C++, C#, and Java
  • 70. Elasticsearch (Java) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V6025 Possibly index '(int) x' is out of bounds. Typical errors in code on the example of C++, C#, and Java
  • 71. IPP Samples (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 72. IPP Samples (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 73. IPP Samples (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 74. IPP Samples (C++) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 75. IPP Samples (C++) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V557 Array overrun is possible. The '30' index is pointing beyond array bound. Typical errors in code on the example of C++, C#, and Java
  • 76. FastReport (C#) Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 77. FastReport (C#) Information Technology Video Developer Network http://itvdn.com ITVDN PVS-Studio warning: V3106 Possible negative index value. The value of 'idx' index could reach -1. Typical errors in code on the example of C++, C#, and Java
  • 78. Information Technology Video Developer Network http://itvdn.com ITVDN • Be careful when you add '0’ to the end of the string • Do you get an external index? Make sure you check it! • Don’t mix up '>' ('<‘) and '>=' ('<=‘) when comparing the index with the array size How to avoid Typical errors in code on the example of C++, C#, and Java
  • 79. 4. How to use static analysis properly Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 80. When you should perform static analysis Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 81. When you should perform static analysis Information Technology Video Developer Network http://itvdn.com ITVDN Static analysis Typical errors in code on the example of C++, C#, and Java
  • 82. How to make the most of static analysis Information Technology Video Developer Network http://itvdn.com ITVDN • Apply static analysis at early stages • Analyze regularly Typical errors in code on the example of C++, C#, and Java
  • 83. Proprietary development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 84. Proprietary development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 85. Proprietary development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 86. Proprietary development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 87. Proprietary development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 88. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 89. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 90. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 91. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 92. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 93. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 94. Corporate development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 95. Open-source development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 96. Open-source development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 97. Open-source development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 98. Open-source development Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 99. More about analysis of commits and pull-requests Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 100. 5. Conclusion Information Technology Video Developer Network http://itvdn.com ITVDN Typical errors in code on the example of C++, C#, and Java
  • 101. Typical error patterns in code Information Technology Video Developer Network http://itvdn.com ITVDN • Copy-paste and last line effect • if (A) {...} else if (A) • Errors in checks • Array index out of bounds • … (the list gradually expands) Typical errors in code on the example of C++, C#, and Java
  • 102. How to avoid typical errors Information Technology Video Developer Network http://itvdn.com ITVDN • Stop copy-pasting! • Seriously, stop copy-pasting! • Pay attention to checks, even small and short ones. • Carefully check array indexes. • Regularly use static analysis. Typical errors in code on the example of C++, C#, and Java
  • 103. Free PVS-Studio license for students Information Technology Video Developer Network http://itvdn.com ITVDN https://bit.ly/pvs-student Typical errors in code on the example of C++, C#, and Java
  • 104. Information Technology Video Developer Network http://itvdn.com ITVDN Q&A Typical errors in code on the example of C++, C#, and Java
  • 105. Information Technology Video Developer Network http://itvdn.com ITVDN Watch our video lessons on C++ At ITVDN you’ll find a collection of video courses and webinars for C++ developers. Go to ITVDN.com and watch our video lessons right now!
  • 106. IT VIDEO DEVELOPERS NETWORK Information Technology Video Developer Network http://itvdn.com ITVDN